From eded07b9848a75e241182fd35b6daf11bd002d4e Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 22 May 2018 12:56:55 +0300 Subject: [PATCH 01/33] delete block --- build/codex-editor.js | 56 ++++++++++++++++++++++++-- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 33 +++++++++++++++ src/components/modules/keyboard.js | 11 +++++ src/components/modules/ui.js | 13 +++--- 5 files changed, 103 insertions(+), 12 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 45d14ad41..d389d3a23 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1549,6 +1549,24 @@ var BlockManager = function (_Module) { this.Editor.Caret.setToBlock(block); } + /** + * Remove block with passed index or remove last + * @param {Number|null} index + */ + + }, { + key: 'removeBlock', + value: function removeBlock(index) { + + this._blocks.remove(index); + + // decrease current block index so that to know current actual + this.currentBlockIndex--; + + // set caret to the block without offset at the end + this.Editor.Caret.setToBlock(this.currentBlock, 0, true); + this.Editor.Toolbar.close(); + } /** * Split current Block * 1. Extract content from Caret position to the Block`s end @@ -1875,6 +1893,24 @@ var Blocks = function () { } } + /** + * Remove block + * @param {Number|null} index + */ + + }, { + key: 'remove', + value: function remove(index) { + + if (!isNaN(index)) { + + index = this.length - 1; + } + + this.blocks[index].html.remove(); + this.blocks.splice(index, 1); + } + /** * Insert Block after passed target * @@ -2639,6 +2675,7 @@ var Keyboard = function (_Module) { case _.keyCodes.BACKSPACE: _.log('Backspace key pressed'); + this.backSpacePressed(event); break; case _.keyCodes.ENTER: @@ -2705,6 +2742,18 @@ var Keyboard = function (_Module) { this.Editor.BlockManager.split(); } + /** + * Handle backspace keypress on block + * @param event + */ + + }, { + key: 'backSpacePressed', + value: function backSpacePressed(event) { + + this.Editor.BlockManager.removeBlock(); + } + /** * Handle right and down keyboard keys */ @@ -4976,6 +5025,8 @@ var UI = function (_Module) { value: function prepare() { var _this2 = this; + // this.Editor.Toolbar.make(); + return this.make() /** * Make toolbar @@ -5097,7 +5148,7 @@ var UI = function (_Module) { /** * @todo bind events with the Listeners module */ - this.nodes.redactor.addEventListener('click', function (event) { + this.Editor.Listeners.on(this.nodes.redactor, 'click', function (event) { return _this4.redactorClicked(event); }, false); } @@ -5139,12 +5190,11 @@ var UI = function (_Module) { try { this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode); + } catch (e) { /** * If clicked outside first-level Blocks, set Caret to the last empty Block */ - } catch (e) { - this.Editor.Caret.setToTheLastBlock(); } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index fe1b0c721..9e9ed59f2 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 7be2b026a9fcbdf8a285","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","childNodes","isElement","isNativeInput","emptyTextNode","text","childsLength","last","getDeepestNode","nodeType","Node","ELEMENT_NODE","nativeInputs","includes","nodeText","value","textContent","replace","trim","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","innerHTML","insert","index","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","remove","deleteCount","splice","insertAdjacentElement","targetBlock","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","preventDefault","split","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","Toolbar","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","close","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA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;;kBAAlBkU,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAThV,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBiV,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT9V,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACT8B,qBAAS,IADA;AAETuJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKvL,KAAL,CAAW8B,OAAX,GAAqBb,EAAEc,IAAF,CAAO,KAAP,EAAcqJ,cAAc/I,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAK9B,KAAL,CAAWqL,YAAX,GAA0BpK,EAAEc,IAAF,CAAO,KAAP,EAAcqJ,cAAc/I,GAAd,CAAkBgJ,YAAhC,CAA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AZ,CAAkBoO,iBAAlB;AAEH;;AAKD;;;AAGA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKja,MAAL,CAAYuW,OAAZ,CAAoBa,IAApB;AACA,WAAKpX,MAAL,CAAYuW,OAAZ,CAAoBe,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKtX,MAAL,CAAYuW,OAAZ,CAAoBkB,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKla,MAAL,CAAYsI,KAAZ,CAAkB6R,SAAlB,CAA4B,KAAKna,MAAL,CAAYwI,YAAZ,CAAyBgD,YAAzB,CAAsCyC,IAAlE,CAArB;AAAA,UACImM,eAAe,KAAKpa,MAAL,CAAYwI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAI2Q,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKpa,MAAL,CAAYuW,OAAZ,CAAoBkB,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBA3OS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAvE2B9Z,M;;AA+ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBApgBqB4I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB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;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7be2b026a9fcbdf8a285","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Element} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node.childNodes.length === 0) {\n\n /**\n * We need to return an empty text node\n * But caret will not be placed in empty textNode, so we need textNode with zero-width char\n */\n if (this.isElement(node) && !this.isNativeInput(node)) {\n\n let emptyTextNode = this.text('\\u200B');\n\n node.appendChild(emptyTextNode);\n\n }\n\n return node;\n\n }\n\n let childsLength = node.childNodes.length,\n last = childsLength - 1;\n\n if (atLast) {\n\n return this.getDeepestNode(node.childNodes[last], atLast);\n\n } else {\n\n return this.getDeepestNode(node.childNodes[0], false);\n\n }\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n event.preventDefault();\n /**\n * Split the Current Block\n */\n this.Editor.BlockManager.split();\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.nodes.redactor.addEventListener('click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n\n } catch (e) {\n\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap e6328a933f70a4da7d35","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","childNodes","isElement","isNativeInput","emptyTextNode","text","childsLength","last","getDeepestNode","nodeType","Node","ELEMENT_NODE","nativeInputs","includes","nodeText","value","textContent","replace","trim","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","isNaN","targetBlock","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","preventDefault","split","removeBlock","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW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A,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATpV,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqV,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBqV,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATlW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACTkC,qBAAS,IADA;AAETuJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK3L,KAAL,CAAWkC,OAAX,GAAqBjB,EAAEkB,IAAF,CAAO,KAAP,EAAcqJ,cAAchJ,GAAd,CAAkBN,OAAhC,CAArB;;AAEA,iBAAKlC,KAAL,CAAWyL,YAAX,GAA0BxK,EAAEkB,IAAF,CAAO,KAAP,EAAcqJ,cAAchJ,GAAd,CAAkBiJ,YAAhC,CAA1B;AACA,iBAAKzL,KAAL,CAAW0L,eAAX,GAA6BzK,EAAEkB,IAAF,CAAO,KAAP,EAAcqJ,cAAchJ,GAAd,CAAkBkJ,eAAhC,CAA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EA;;AAEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKna,MAAL,CAAYoM,OAAZ,CAAoBmL,IAApB;AACA,WAAKvX,MAAL,CAAYoM,OAAZ,CAAoBqL,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKzX,MAAL,CAAYoM,OAAZ,CAAoBuL,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKpa,MAAL,CAAYsI,KAAZ,CAAkB+R,SAAlB,CAA4B,KAAKra,MAAL,CAAYwI,YAAZ,CAAyBgD,YAAzB,CAAsC2C,IAAlE,CAArB;AAAA,UACImM,eAAe,KAAKta,MAAL,CAAYwI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAI6Q,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKta,MAAL,CAAYoM,OAAZ,CAAoBuL,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bha,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB4I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK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A;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e6328a933f70a4da7d35","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Element} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node.childNodes.length === 0) {\n\n /**\n * We need to return an empty text node\n * But caret will not be placed in empty textNode, so we need textNode with zero-width char\n */\n if (this.isElement(node) && !this.isNativeInput(node)) {\n\n let emptyTextNode = this.text('\\u200B');\n\n node.appendChild(emptyTextNode);\n\n }\n\n return node;\n\n }\n\n let childsLength = node.childNodes.length,\n last = childsLength - 1;\n\n if (atLast) {\n\n return this.getDeepestNode(node.childNodes[last], atLast);\n\n } else {\n\n return this.getDeepestNode(node.childNodes[0], false);\n\n }\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n event.preventDefault();\n /**\n * Split the Current Block\n */\n this.Editor.BlockManager.split();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n this.Editor.BlockManager.removeBlock();\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index eb38ba629..69d521c4a 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -185,6 +185,22 @@ export default class BlockManager extends Module { } + /** + * Remove block with passed index or remove last + * @param {Number|null} index + */ + removeBlock(index) { + + this._blocks.remove(index); + + // decrease current block index so that to know current actual + this.currentBlockIndex--; + + // set caret to the block without offset at the end + this.Editor.Caret.setToBlock(this.currentBlock, 0, true); + this.Editor.Toolbar.close(); + + } /** * Split current Block * 1. Extract content from Caret position to the Block`s end @@ -484,6 +500,23 @@ class Blocks { } + /** + * Remove block + * @param {Number|null} index + */ + remove(index) { + + if (!isNaN(index)) { + + index = this.length - 1; + + } + + this.blocks[index].html.remove(); + this.blocks.splice(index, 1); + + } + /** * Insert Block after passed target * diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 9094dfe34..3a5caf4c3 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -34,6 +34,7 @@ export default class Keyboard extends Module { case _.keyCodes.BACKSPACE: _.log('Backspace key pressed'); + this.backSpacePressed(event); break; case _.keyCodes.ENTER: @@ -101,6 +102,16 @@ export default class Keyboard extends Module { } + /** + * Handle backspace keypress on block + * @param event + */ + backSpacePressed(event) { + + this.Editor.BlockManager.removeBlock(); + + } + /** * Handle right and down keyboard keys */ diff --git a/src/components/modules/ui.js b/src/components/modules/ui.js index b7922d72d..f80cf804f 100644 --- a/src/components/modules/ui.js +++ b/src/components/modules/ui.js @@ -75,7 +75,7 @@ export default class UI extends Module { */ prepare() { - this.Editor.Toolbar.make() + // this.Editor.Toolbar.make(); return this.make() /** @@ -194,7 +194,7 @@ export default class UI extends Module { /** * @todo bind events with the Listeners module */ - this.nodes.redactor.addEventListener('click', event => this.redactorClicked(event), false ); + this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false ); } @@ -233,19 +233,16 @@ export default class UI extends Module { this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode); - /** - * If clicked outside first-level Blocks, set Caret to the last empty Block - */ - } catch (e) { + /** + * If clicked outside first-level Blocks, set Caret to the last empty Block + */ this.Editor.Caret.setToTheLastBlock(); } - - /** * @todo hide the Inline Toolbar */ From d29b3ae772e9266e5f79543306bcbdb95e44861d Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 22 May 2018 14:40:11 +0300 Subject: [PATCH 02/33] dom improvements and merging blocks --- build/codex-editor.js | 98 ++++++++++++++++++++------ build/codex-editor.js.map | 2 +- src/components/dom.js | 31 +++----- src/components/modules/blockManager.js | 32 +++++++++ src/components/modules/caret.js | 28 ++++++++ src/components/modules/keyboard.js | 7 +- 6 files changed, 151 insertions(+), 47 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index d389d3a23..d6df1259e 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -532,7 +532,7 @@ var Dom = function () { * * @description Method recursively goes throw the all Node until it finds the Leaf * - * @param {Element} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} + * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it */ @@ -543,32 +543,18 @@ var Dom = function () { var atLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (node.childNodes.length === 0) { + if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { - /** - * We need to return an empty text node - * But caret will not be placed in empty textNode, so we need textNode with zero-width char - */ - if (this.isElement(node) && !this.isNativeInput(node)) { + if (atLast) { - var emptyTextNode = this.text('\u200B'); + return this.getDeepestNode(node.lastChild, atLast); + } else { - node.appendChild(emptyTextNode); + return this.getDeepestNode(node.firstChild, false); } - - return node; } - var childsLength = node.childNodes.length, - last = childsLength - 1; - - if (atLast) { - - return this.getDeepestNode(node.childNodes[last], atLast); - } else { - - return this.getDeepestNode(node.childNodes[0], false); - } + return node; } /** @@ -1549,6 +1535,38 @@ var BlockManager = function (_Module) { this.Editor.Caret.setToBlock(block); } + /** + * + * @param targetBlock + * @param mergingBlock + */ + + }, { + key: 'mergeBlocks', + value: function mergeBlocks(targetBlock, mergingBlock) { + + if (!targetBlock) { + + targetBlock = this._blocks[this.currentBlockIndex - 1]; + } + + if (!mergingBlock) { + + mergingBlock = this._blocks[this.currentBlockIndex]; + } + + var range = document.createRange(); + + range.selectNodeContents(mergingBlock.pluginsContent); + + var extracted = range.extractContents(); + + targetBlock.pluginsContent.appendChild(extracted); + targetBlock.pluginsContent.normalize(); + + this.removeBlock(this.currentBlockIndex); + } + /** * Remove block with passed index or remove last * @param {Number|null} index @@ -2497,6 +2515,38 @@ var Caret = function (_Module) { } } } + + /** + * Get's deepest first node and checks if offset is zero + * @return {boolean} + */ + + }, { + key: 'isAtStart', + get: function get() { + + var selection = _Selection2.default.get(), + anchorNode = selection.anchorNode, + firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + + return anchorNode === firstNode && selection.anchorOffset === 0; + } + + /** + * Get's deepest last node and checks if offset is last node text length + * @return {boolean} + */ + + }, { + key: 'isAtEnd', + get: function get() { + + var selection = _Selection2.default.get(), + anchorNode = selection.anchorNode, + lastNode = $.getDeepest; + + return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; + } }]); return Caret; @@ -2751,7 +2801,11 @@ var Keyboard = function (_Module) { key: 'backSpacePressed', value: function backSpacePressed(event) { - this.Editor.BlockManager.removeBlock(); + if (this.Editor.Caret.isAtStart) { + + this.Editor.BlockManager.mergeBlocks(); + event.preventDefault(); + } } /** diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 9e9ed59f2..e560ccdce 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap e6328a933f70a4da7d35","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","childNodes","isElement","isNativeInput","emptyTextNode","text","childsLength","last","getDeepestNode","nodeType","Node","ELEMENT_NODE","nativeInputs","includes","nodeText","value","textContent","replace","trim","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","isNaN","targetBlock","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","preventDefault","split","removeBlock","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC4J,QAAQ5H,SAAR,CAAkB6H,OAAvB,EACID,QAAQ5H,SAAR,CAAkB6H,OAAlB,GAA4BD,QAAQ5H,SAAR,CAAkB8H,iBAAlB,IACxBF,QAAQ5H,SAAR,CAAkB+H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ5H,SAAR,CAAkBgI,OAAvB,EACIJ,QAAQ5H,SAAR,CAAkBgI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGoG,UAA5B;AAEH,KALD,QAKSpG,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACp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BtU,MAArB;AAEH;AAEJ;;;8BAkCY4U,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkC7U,M;;;kBAAlBsU,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;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AUA,KAFP;AAGHiN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BlW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBqV,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATlW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACTkC,qBAAS,IADA;AAETuJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK3L,KAAL,CAAWkC,OAAX,GAAqBjB,EAAEkB,IAAF,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AFb,OAAP;AAKH;;;;EAzE2Bha,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB4I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eA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A;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e6328a933f70a4da7d35","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Element} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node.childNodes.length === 0) {\n\n /**\n * We need to return an empty text node\n * But caret will not be placed in empty textNode, so we need textNode with zero-width char\n */\n if (this.isElement(node) && !this.isNativeInput(node)) {\n\n let emptyTextNode = this.text('\\u200B');\n\n node.appendChild(emptyTextNode);\n\n }\n\n return node;\n\n }\n\n let childsLength = node.childNodes.length,\n last = childsLength - 1;\n\n if (atLast) {\n\n return this.getDeepestNode(node.childNodes[last], atLast);\n\n } else {\n\n return this.getDeepestNode(node.childNodes[0], false);\n\n }\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n event.preventDefault();\n /**\n * Split the Current Block\n */\n this.Editor.BlockManager.split();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n this.Editor.BlockManager.removeBlock();\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 491faf51825feef6c784","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","getDeepestNode","lastChild","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","range","createRange","selectNodeContents","extracted","extractContents","normalize","removeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","isNaN","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","endContainer","endOffset","firstNode","lastNode","getDeepest","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","preventDefault","split","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACyJ,QAAQzH,SAAR,CAAkB0H,OAAvB,EACID,QAAQzH,SAAR,CAAkB0H,OAAlB,GAA4BD,QAAQzH,SAAR,CAAkB2H,iBAAlB,IACxBF,QAAQzH,SAAR,CAAkB4H,qBADtB;;AAGJ,IAAI,CAACH,QAAQzH,SAAR,CAAkB6H,OAAvB,EACIJ,QAAQzH,SAAR,CAAkB6H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI7F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS6F,eAAT,CAAyBC,QAAzB,CAAkC/F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGyF,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO7F,EAAP;AACnBA,aAAKA,GAAGgG,aAAH,IAAoBhG,GAAGiG,UAA5B;AAEH,KALD,QAKSjG,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAL,GAAqB5U,MAArB;AAEH;AAEJ;;;8BAkCYkV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCnV,M;;;kBAAlB4U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,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AAEHzN,uBAAUA,KAFP;AAGH0N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKuK,KAAL,GAAa;AACT2C,qBAAS,IADA;AAETuJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKpM,KAAL,CAAW2C,OAAX,GAAqB1B,EA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B;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqByI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,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AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 491faf51825feef6c784","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n if (atLast) {\n\n return this.getDeepestNode(node.lastChild, atLast);\n\n } else {\n\n return this.getDeepestNode(node.firstChild, false);\n\n }\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n *\n * @param targetBlock\n * @param mergingBlock\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n let range = document.createRange();\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n\n let extracted = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extracted);\n targetBlock.pluginsContent.normalize();\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepest;\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n event.preventDefault();\n /**\n * Split the Current Block\n */\n this.Editor.BlockManager.split();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index 621db406d..aeda75502 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -103,42 +103,27 @@ export default class Dom { * * @description Method recursively goes throw the all Node until it finds the Leaf * - * @param {Element} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} + * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it */ static getDeepestNode(node, atLast = false) { - if (node.childNodes.length === 0) { + if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { - /** - * We need to return an empty text node - * But caret will not be placed in empty textNode, so we need textNode with zero-width char - */ - if (this.isElement(node) && !this.isNativeInput(node)) { + if (atLast) { - let emptyTextNode = this.text('\u200B'); + return this.getDeepestNode(node.lastChild, atLast); - node.appendChild(emptyTextNode); + } else { - } + return this.getDeepestNode(node.firstChild, false); - return node; + } } - let childsLength = node.childNodes.length, - last = childsLength - 1; - - if (atLast) { - - return this.getDeepestNode(node.childNodes[last], atLast); - - } else { - - return this.getDeepestNode(node.childNodes[0], false); - - } + return node; } diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 69d521c4a..e58959255 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -185,6 +185,38 @@ export default class BlockManager extends Module { } + /** + * + * @param targetBlock + * @param mergingBlock + */ + mergeBlocks(targetBlock, mergingBlock) { + + if (!targetBlock) { + + targetBlock = this._blocks[this.currentBlockIndex - 1]; + + } + + if (!mergingBlock) { + + mergingBlock = this._blocks[this.currentBlockIndex]; + + } + + let range = document.createRange(); + + range.selectNodeContents(mergingBlock.pluginsContent); + + let extracted = range.extractContents(); + + targetBlock.pluginsContent.appendChild(extracted); + targetBlock.pluginsContent.normalize(); + + this.removeBlock(this.currentBlockIndex); + + } + /** * Remove block with passed index or remove last * @param {Number|null} index diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 5fb88addf..c2f80a995 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -144,4 +144,32 @@ export default class Caret extends Module { } + /** + * Get's deepest first node and checks if offset is zero + * @return {boolean} + */ + get isAtStart() { + + let selection = Selection.get(), + anchorNode = selection.anchorNode, + firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + + return anchorNode === firstNode && selection.anchorOffset === 0; + + } + + /** + * Get's deepest last node and checks if offset is last node text length + * @return {boolean} + */ + get isAtEnd() { + + let selection = Selection.get(), + anchorNode = selection.anchorNode, + lastNode = $.getDeepest; + + return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; + + } + } diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 3a5caf4c3..ab1e1eae2 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -108,7 +108,12 @@ export default class Keyboard extends Module { */ backSpacePressed(event) { - this.Editor.BlockManager.removeBlock(); + if (this.Editor.Caret.isAtStart) { + + this.Editor.BlockManager.mergeBlocks(); + event.preventDefault(); + + } } From 7c7f978e61fa78904fbae3cb3100c46b120d75ed Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 22 May 2018 14:53:24 +0300 Subject: [PATCH 03/33] merge and split improvements --- build/codex-editor.js | 37 ++++++++++++++++---------- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 20 ++++++++------ src/components/modules/caret.js | 5 +++- src/components/modules/keyboard.js | 14 ++++++---- 5 files changed, 49 insertions(+), 29 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index d6df1259e..cef6aca48 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1536,9 +1536,9 @@ var BlockManager = function (_Module) { } /** - * - * @param targetBlock - * @param mergingBlock + * Merge two blocks + * @param {Block} targetBlock - block to merge + * @param {Block} mergingBlock - block that will be merged with target block */ }, { @@ -1555,14 +1555,17 @@ var BlockManager = function (_Module) { mergingBlock = this._blocks[this.currentBlockIndex]; } - var range = document.createRange(); + if (mergingBlock.html.textContent.trim() !== '') { - range.selectNodeContents(mergingBlock.pluginsContent); + var range = document.createRange(), + extractedBlock = void 0; - var extracted = range.extractContents(); + range.selectNodeContents(mergingBlock.pluginsContent); + extractedBlock = range.extractContents(); - targetBlock.pluginsContent.appendChild(extracted); - targetBlock.pluginsContent.normalize(); + targetBlock.pluginsContent.appendChild(extractedBlock); + targetBlock.pluginsContent.normalize(); + } this.removeBlock(this.currentBlockIndex); } @@ -2543,7 +2546,10 @@ var Caret = function (_Module) { var selection = _Selection2.default.get(), anchorNode = selection.anchorNode, - lastNode = $.getDeepest; + lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); + + // console.log('lastNode', lastNode); + // console.log('anchorNode', anchorNode); return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; } @@ -2785,11 +2791,14 @@ var Keyboard = function (_Module) { return; } - event.preventDefault(); - /** - * Split the Current Block - */ - this.Editor.BlockManager.split(); + if (this.Editor.Caret.isAtEnd) { + + /** + * Split the Current Block into two blocks + */ + this.Editor.BlockManager.split(); + event.preventDefault(); + } } /** diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index e560ccdce..dab793cba 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 491faf51825feef6c784","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","getDeepestNode","lastChild","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","range","createRange","selectNodeContents","extracted","extractContents","normalize","removeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","isNaN","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","endContainer","endOffset","firstNode","lastNode","getDeepest","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","preventDefault","split","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AA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EH,qBAAKrJ,MAAL,CAAY6I,YAAZ,GAA2B7I,OAAO6I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK7I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACyJ,QAAQzH,SAAR,CAAkB0H,OAAvB,EACID,QAAQzH,SAAR,CAAkB0H,OAAlB,GAA4BD,QAAQzH,SAAR,CAAkB2H,iBAAlB,IACxBF,QAAQzH,SAAR,CAAkB4H,qBADtB;;AAGJ,IAAI,CAACH,QAAQzH,SAAR,CAAkB6H,OAAvB,EACIJ,QAAQzH,SAAR,CAAkB6H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI7F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS6F,eAAT,CAAyBC,QAAzB,CAAkC/F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGyF,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO7F,EAAP;AACnBA,aAAKA,GAAGgG,aAA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xB;AACA/G,sBAAMvC,IAAN,CAAW8P,WAAWvU,IAAtB;AAEH,aAPD;;AASAlB,oBAAQiH,GAAR,CAAY,OAAZ,EAAqBsO,SAArB;AACAvV,oBAAQ0V,QAAR;;AAEA,mBAAO;AACHzG,sBAAU,CAAC,IAAI0G,IAAJ,EADR;AAEHzN,uBAAUA,KAFP;AAGH0N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKuK,KAAL,GA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AAsCjC,OADzD;;AAGA,UAAIsR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK5a,MAAL,CAAY0M,OAAZ,CAAoBuL,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 491faf51825feef6c784","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n if (atLast) {\n\n return this.getDeepestNode(node.lastChild, atLast);\n\n } else {\n\n return this.getDeepestNode(node.firstChild, false);\n\n }\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n *\n * @param targetBlock\n * @param mergingBlock\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n let range = document.createRange();\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n\n let extracted = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extracted);\n targetBlock.pluginsContent.normalize();\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepest;\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n event.preventDefault();\n /**\n * Split the Current Block\n */\n this.Editor.BlockManager.split();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap b09de4cf0fe526792cce","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","getDeepestNode","lastChild","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","html","range","createRange","extractedBlock","selectNodeContents","extractContents","normalize","removeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","isNaN","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;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ClV,M;;;kBAAlB2U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATzV,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,E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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKuK,KAAL,GAAa;AACT4C,qBAAS,IADA;AAETqJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKnM,KAAL,CAAW4C,OAAX,GAAqB3B,EAAE4B,IAAF,CAAO,KAAP,EAAcmJ,cAAc7I,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAK5C,KAAL,CAAWiM,YAAX,GAA0BhL,EAAE4B,IAAF,CAAO,KAAP,EAAcmJ,cAAc7I,GAAd,CAAkB8I,YAAhC,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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqByI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B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ACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b09de4cf0fe526792cce","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n if (atLast) {\n\n return this.getDeepestNode(node.lastChild, atLast);\n\n } else {\n\n return this.getDeepestNode(node.firstChild, false);\n\n }\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} mergingBlock - block that will be merged with target block\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n if (mergingBlock.html.textContent.trim() !== '') {\n\n let range = document.createRange(),\n extractedBlock;\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n // console.log('lastNode', lastNode);\n // console.log('anchorNode', anchorNode);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n \n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index e58959255..076f5f17e 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -186,9 +186,9 @@ export default class BlockManager extends Module { } /** - * - * @param targetBlock - * @param mergingBlock + * Merge two blocks + * @param {Block} targetBlock - block to merge + * @param {Block} mergingBlock - block that will be merged with target block */ mergeBlocks(targetBlock, mergingBlock) { @@ -204,14 +204,18 @@ export default class BlockManager extends Module { } - let range = document.createRange(); + if (mergingBlock.html.textContent.trim() !== '') { + + let range = document.createRange(), + extractedBlock; - range.selectNodeContents(mergingBlock.pluginsContent); + range.selectNodeContents(mergingBlock.pluginsContent); + extractedBlock = range.extractContents(); - let extracted = range.extractContents(); + targetBlock.pluginsContent.appendChild(extractedBlock); + targetBlock.pluginsContent.normalize(); - targetBlock.pluginsContent.appendChild(extracted); - targetBlock.pluginsContent.normalize(); + } this.removeBlock(this.currentBlockIndex); diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index c2f80a995..3979d4475 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -166,7 +166,10 @@ export default class Caret extends Module { let selection = Selection.get(), anchorNode = selection.anchorNode, - lastNode = $.getDeepest; + lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); + + // console.log('lastNode', lastNode); + // console.log('anchorNode', anchorNode); return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index ab1e1eae2..07df2dec2 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -94,11 +94,15 @@ export default class Keyboard extends Module { } - event.preventDefault(); - /** - * Split the Current Block - */ - this.Editor.BlockManager.split(); + if (this.Editor.Caret.isAtEnd) { + + /** + * Split the Current Block into two blocks + */ + this.Editor.BlockManager.split(); + event.preventDefault(); + + } } From d2470fe44d55ba951c61c49fa66fc68a12008eb2 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 22 May 2018 16:52:11 +0300 Subject: [PATCH 04/33] fix merging --- build/codex-editor.js | 27 +++++++++++++------------- build/codex-editor.js.map | 2 +- src/components/dom.js | 10 ++-------- src/components/modules/blockManager.js | 14 ++++++++++--- src/components/modules/caret.js | 3 --- src/components/modules/keyboard.js | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index cef6aca48..57a7cd0e3 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -545,13 +545,9 @@ var Dom = function () { if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { - if (atLast) { + var nodeChild = atLast ? node.lastChild : node.firstChild; - return this.getDeepestNode(node.lastChild, atLast); - } else { - - return this.getDeepestNode(node.firstChild, false); - } + return this.getDeepestNode(nodeChild, atLast); } return node; @@ -1555,11 +1551,16 @@ var BlockManager = function (_Module) { mergingBlock = this._blocks[this.currentBlockIndex]; } - if (mergingBlock.html.textContent.trim() !== '') { + if (!$.isEmpty(mergingBlock.html)) { - var range = document.createRange(), + var selection = _Selection2.default.get(), + selectRange = selection.getRangeAt(0), extractedBlock = void 0; + selectRange.deleteContents(); + + var range = selectRange.cloneRange(true); + range.selectNodeContents(mergingBlock.pluginsContent); extractedBlock = range.extractContents(); @@ -1584,6 +1585,8 @@ var BlockManager = function (_Module) { // decrease current block index so that to know current actual this.currentBlockIndex--; + this.currentNode = this._blocks[this.currentBlockIndex].html; + // set caret to the block without offset at the end this.Editor.Caret.setToBlock(this.currentBlock, 0, true); this.Editor.Toolbar.close(); @@ -1923,11 +1926,12 @@ var Blocks = function () { key: 'remove', value: function remove(index) { - if (!isNaN(index)) { + if (!index) { index = this.length - 1; } + // this.blocks[index].html; this.blocks[index].html.remove(); this.blocks.splice(index, 1); } @@ -2548,9 +2552,6 @@ var Caret = function (_Module) { anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); - // console.log('lastNode', lastNode); - // console.log('anchorNode', anchorNode); - return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; } }]); @@ -2810,7 +2811,7 @@ var Keyboard = function (_Module) { key: 'backSpacePressed', value: function backSpacePressed(event) { - if (this.Editor.Caret.isAtStart) { + if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) { this.Editor.BlockManager.mergeBlocks(); event.preventDefault(); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index dab793cba..9e2def465 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap b09de4cf0fe526792cce","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","getDeepestNode","lastChild","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","html","range","createRange","extractedBlock","selectNodeContents","extractContents","normalize","removeBlock","index","remove","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","isNaN","newBlock","children","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;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aO;;AAEH,qBAAKZ,aAAL,GAAqB3U,MAArB;AAEH;AAEJ;;;8BAkCYiV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkClV,M;;;kBAAlB2U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA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I0G,IAAJ,EADR;AAEHxN,uBAAUA,KAFP;AAGHyN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BvW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKuK,KAAL,GAAa;AACT4C,qBAAS,IADA;AAETqJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKnM,KAAL,CAAW4C,O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ADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqByI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2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ACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b09de4cf0fe526792cce","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n if (atLast) {\n\n return this.getDeepestNode(node.lastChild, atLast);\n\n } else {\n\n return this.getDeepestNode(node.firstChild, false);\n\n }\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} mergingBlock - block that will be merged with target block\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n if (mergingBlock.html.textContent.trim() !== '') {\n\n let range = document.createRange(),\n extractedBlock;\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!isNaN(index)) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n // console.log('lastNode', lastNode);\n // console.log('anchorNode', anchorNode);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n \n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 62370e24c0b68edfca44","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","html","selectRange","getRangeAt","extractedBlock","deleteContents","range","cloneRange","selectNodeContents","extractContents","normalize","removeBlock","index","remove","currentNode","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","blockElem","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAE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;AAHN;AAFD;AADW,iBAArB;AAWH,aAbD,MAaO;;AAEH,qBAAKZ,aAAL,GAAqB5U,MAArB;AAEH;AAEJ;;;8BAkCYkV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCnV,M;;;kBAAlB4U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;A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AAR;;AAEA,mBAAO;AACHtG,sBAAU,CAAC,IAAIuG,IAAJ,EADR;AAEHxN,uBAAUA,KAFP;AAGHyN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTgD,qBAAS,IADA;AAETiJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;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EN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uB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ACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 62370e24c0b68edfca44","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} mergingBlock - block that will be merged with target block\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!$.isEmpty(mergingBlock.html)) {\n\n let selection = Selection.get(),\n selectRange = selection.getRangeAt(0),\n extractedBlock;\n\n selectRange.deleteContents();\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index aeda75502..a22a70e4f 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -111,15 +111,9 @@ export default class Dom { if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { - if (atLast) { + let nodeChild = atLast ? node.lastChild : node.firstChild; - return this.getDeepestNode(node.lastChild, atLast); - - } else { - - return this.getDeepestNode(node.firstChild, false); - - } + return this.getDeepestNode(nodeChild, atLast); } diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 076f5f17e..39b86589a 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -204,11 +204,16 @@ export default class BlockManager extends Module { } - if (mergingBlock.html.textContent.trim() !== '') { + if (!$.isEmpty(mergingBlock.html)) { - let range = document.createRange(), + let selection = Selection.get(), + selectRange = selection.getRangeAt(0), extractedBlock; + selectRange.deleteContents(); + + let range = selectRange.cloneRange(true); + range.selectNodeContents(mergingBlock.pluginsContent); extractedBlock = range.extractContents(); @@ -232,6 +237,8 @@ export default class BlockManager extends Module { // decrease current block index so that to know current actual this.currentBlockIndex--; + this.currentNode = this._blocks[this.currentBlockIndex].html; + // set caret to the block without offset at the end this.Editor.Caret.setToBlock(this.currentBlock, 0, true); this.Editor.Toolbar.close(); @@ -542,12 +549,13 @@ class Blocks { */ remove(index) { - if (!isNaN(index)) { + if (!index) { index = this.length - 1; } + // this.blocks[index].html; this.blocks[index].html.remove(); this.blocks.splice(index, 1); diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 3979d4475..ea7cb3fcd 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -168,9 +168,6 @@ export default class Caret extends Module { anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); - // console.log('lastNode', lastNode); - // console.log('anchorNode', anchorNode); - return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; } diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 07df2dec2..ec18d7249 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -112,7 +112,7 @@ export default class Keyboard extends Module { */ backSpacePressed(event) { - if (this.Editor.Caret.isAtStart) { + if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) { this.Editor.BlockManager.mergeBlocks(); event.preventDefault(); From 0f0de88c001e9e098c84e6c4b6dd0eb118ac7573 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 22 May 2018 17:33:23 +0300 Subject: [PATCH 05/33] do not remove block if block contains media --- build/codex-editor.js | 43 +++++++++++++++++++------- build/codex-editor.js.map | 2 +- src/components/dom.js | 16 ++++++++++ src/components/modules/blockManager.js | 12 +++---- src/components/modules/keyboard.js | 12 +++++-- 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 57a7cd0e3..573a7a664 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -582,6 +582,22 @@ var Dom = function () { return target ? nativeInputs.includes(target.tagName) : false; } + /** + * Check passed node if it has IMG, Twitter, iframe or something that could contain media + * @param target + */ + + }, { + key: 'hasMediaContent', + value: function hasMediaContent(target) { + + var mayContainMedia = ['IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED']; + + var foundMediaContent = target.querySelectorAll(mayContainMedia.join()); + + return foundMediaContent.length !== 0; + } + /** * Checks node if it is empty * @@ -1534,24 +1550,24 @@ var BlockManager = function (_Module) { /** * Merge two blocks * @param {Block} targetBlock - block to merge - * @param {Block} mergingBlock - block that will be merged with target block + * @param {Block} blockToMerge - block that will be merged with target block */ }, { key: 'mergeBlocks', - value: function mergeBlocks(targetBlock, mergingBlock) { + value: function mergeBlocks(targetBlock, blockToMerge) { if (!targetBlock) { targetBlock = this._blocks[this.currentBlockIndex - 1]; } - if (!mergingBlock) { + if (!blockToMerge) { - mergingBlock = this._blocks[this.currentBlockIndex]; + blockToMerge = this._blocks[this.currentBlockIndex]; } - if (!$.isEmpty(mergingBlock.html)) { + if (!$.isEmpty(blockToMerge.html)) { var selection = _Selection2.default.get(), selectRange = selection.getRangeAt(0), @@ -1561,7 +1577,7 @@ var BlockManager = function (_Module) { var range = selectRange.cloneRange(true); - range.selectNodeContents(mergingBlock.pluginsContent); + range.selectNodeContents(blockToMerge.pluginsContent); extractedBlock = range.extractContents(); targetBlock.pluginsContent.appendChild(extractedBlock); @@ -2675,7 +2691,7 @@ module.exports = exports["default"]; /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(Module, _) { +/* WEBPACK VAR INJECTION */(function(Module, _, $) { Object.defineProperty(exports, "__esModule", { value: true @@ -2811,11 +2827,16 @@ var Keyboard = function (_Module) { key: 'backSpacePressed', value: function backSpacePressed(event) { - if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) { + var isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, + canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock; - this.Editor.BlockManager.mergeBlocks(); - event.preventDefault(); + if (!canMergeBlocks) { + + return; } + + this.Editor.BlockManager.mergeBlocks(); + event.preventDefault(); } /** @@ -2847,7 +2868,7 @@ var Keyboard = function (_Module) { Keyboard.displayName = 'Keyboard'; exports.default = Keyboard; module.exports = exports['default']; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1), __webpack_require__(2))) /***/ }), /* 12 */ diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 9e2def465..de6b15a7b 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 62370e24c0b68edfca44","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","mergingBlock","html","selectRange","getRangeAt","extractedBlock","deleteContents","range","cloneRange","selectNodeContents","extractContents","normalize","removeBlock","index","remove","currentNode","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","blockElem","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL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B;AAWH,aAbD,MAaO;;AAEH,qBAAKZ,aAAL,GAAqB5U,MAArB;AAEH;AAEJ;;;8BAkCYkV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCnV,M;;;kBAAlB4U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAA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tG,sBAAU,CAAC,IAAIuG,IAAJ,EADR;AAEHxN,uBAAUA,KAFP;AAGHyN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTgD,qBAAS,IADA;AAETiJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAA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,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2B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B;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 62370e24c0b68edfca44","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} mergingBlock - block that will be merged with target block\n */\n mergeBlocks(targetBlock, mergingBlock) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!mergingBlock) {\n\n mergingBlock = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!$.isEmpty(mergingBlock.html)) {\n\n let selection = Selection.get(),\n selectRange = selection.getRangeAt(0),\n extractedBlock;\n\n selectRange.deleteContents();\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(mergingBlock.pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) {\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 3fa18ff14e4c75b6069d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","mayContainMedia","foundMediaContent","join","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","html","selectRange","getRangeAt","extractedBlock","deleteContents","range","cloneRange","selectNodeContents","extractContents","normalize","removeBlock","index","remove","currentNode","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","offset","atEnd","focus","nodeToSet","delay","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","blockElem","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","canMergeBlocks","hasMediaContent","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,K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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GAAGqG,UAA5B;AAEH,KALD,QAKSrG,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;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KC,UAAL,CAAgBD,gBAAhB,CAAtB;AAAA,aADH,EAEF7U,IAFE,CAEG,UAAC+U,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIlN,QAAQ,EAAZ;AAAA,gBACIqN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAanJ,KAAb,EAAuB;;AAE5C;AACA1M,wBAAQqH,GAAR,UAAgBwO,WAAWnH,IAA3B,uBAAgDmH,UAAhD;AACAF,6BAAaE,WAAWtG,IAAxB;AACAjH,sBAAMvC,IAAN,CAAW8P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBsO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHvG,sBAAU,CAAC,IAAIwG,IAAJ,EADR;AAEHzN,uBAAUA,KAFP;AAGH0N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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ACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK7a,MAAL,CAAYmN,OAAZ,CAAoB8K,IAApB;AACA,WAAKjY,MAAL,CAAYmN,OAAZ,CAAoBgL,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAYmN,OAAZ,CAAoBkL,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYuI,KAAZ,CAAkBwS,SAAlB,CAA4B,KAAK/a,MAAL,CAAYyI,YAAZ,CAAyBgD,YAAzB,CAAsCuD,IAAlE,CAArB;AAAA,UACIgM,eAAe,KAAKhb,MAAL,CAAYyI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIsR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAYmN,OAAZ,CAAoBkL,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3fa18ff14e4c75b6069d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Check passed node if it has IMG, Twitter, iframe or something that could contain media\n * @param target\n */\n static hasMediaContent(target) {\n\n let mayContainMedia = [\n 'IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED'\n ];\n\n let foundMediaContent = target.querySelectorAll(mayContainMedia.join());\n\n return foundMediaContent.length !== 0;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!$.isEmpty(blockToMerge .html)) {\n\n let selection = Selection.get(),\n selectRange = selection.getRangeAt(0),\n extractedBlock;\n\n selectRange.deleteContents();\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockToMerge .pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index a22a70e4f..c2a512952 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -149,6 +149,22 @@ export default class Dom { } + /** + * Check passed node if it has IMG, Twitter, iframe or something that could contain media + * @param target + */ + static hasMediaContent(target) { + + let mayContainMedia = [ + 'IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED' + ]; + + let foundMediaContent = target.querySelectorAll(mayContainMedia.join()); + + return foundMediaContent.length !== 0; + + } + /** * Checks node if it is empty * diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 39b86589a..53a353072 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -188,9 +188,9 @@ export default class BlockManager extends Module { /** * Merge two blocks * @param {Block} targetBlock - block to merge - * @param {Block} mergingBlock - block that will be merged with target block + * @param {Block} blockToMerge - block that will be merged with target block */ - mergeBlocks(targetBlock, mergingBlock) { + mergeBlocks(targetBlock, blockToMerge ) { if (!targetBlock) { @@ -198,13 +198,13 @@ export default class BlockManager extends Module { } - if (!mergingBlock) { + if (!blockToMerge ) { - mergingBlock = this._blocks[this.currentBlockIndex]; + blockToMerge = this._blocks[this.currentBlockIndex]; } - if (!$.isEmpty(mergingBlock.html)) { + if (!$.isEmpty(blockToMerge .html)) { let selection = Selection.get(), selectRange = selection.getRangeAt(0), @@ -214,7 +214,7 @@ export default class BlockManager extends Module { let range = selectRange.cloneRange(true); - range.selectNodeContents(mergingBlock.pluginsContent); + range.selectNodeContents(blockToMerge .pluginsContent); extractedBlock = range.extractContents(); targetBlock.pluginsContent.appendChild(extractedBlock); diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index ec18d7249..69e388a94 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -112,13 +112,19 @@ export default class Keyboard extends Module { */ backSpacePressed(event) { - if (this.Editor.Caret.isAtStart && this.Editor.BlockManager.currentBlockIndex !== 0) { + let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, + canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock; - this.Editor.BlockManager.mergeBlocks(); - event.preventDefault(); + if (!canMergeBlocks) { + + return; } + this.Editor.BlockManager.mergeBlocks(); + event.preventDefault(); + + } /** From e3be9ead622814c24c302728ee8f595cad8c89f9 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Thu, 24 May 2018 19:19:46 +0300 Subject: [PATCH 06/33] optimize code --- build/codex-editor.js | 60 +++++++------------------- build/codex-editor.js.map | 2 +- src/components/dom.js | 16 ------- src/components/modules/blockManager.js | 20 ++------- src/components/modules/keyboard.js | 20 +++++---- 5 files changed, 31 insertions(+), 87 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 573a7a664..5f69cc0ee 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -582,22 +582,6 @@ var Dom = function () { return target ? nativeInputs.includes(target.tagName) : false; } - /** - * Check passed node if it has IMG, Twitter, iframe or something that could contain media - * @param target - */ - - }, { - key: 'hasMediaContent', - value: function hasMediaContent(target) { - - var mayContainMedia = ['IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED']; - - var foundMediaContent = target.querySelectorAll(mayContainMedia.join()); - - return foundMediaContent.length !== 0; - } - /** * Checks node if it is empty * @@ -1549,7 +1533,7 @@ var BlockManager = function (_Module) { /** * Merge two blocks - * @param {Block} targetBlock - block to merge + * @param {Block} targetBlock - previous block will be append to this block * @param {Block} blockToMerge - block that will be merged with target block */ @@ -1567,18 +1551,9 @@ var BlockManager = function (_Module) { blockToMerge = this._blocks[this.currentBlockIndex]; } - if (!$.isEmpty(blockToMerge.html)) { - - var selection = _Selection2.default.get(), - selectRange = selection.getRangeAt(0), - extractedBlock = void 0; - - selectRange.deleteContents(); + if (!blockToMerge.isEmpty) { - var range = selectRange.cloneRange(true); - - range.selectNodeContents(blockToMerge.pluginsContent); - extractedBlock = range.extractContents(); + var extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition(); targetBlock.pluginsContent.appendChild(extractedBlock); targetBlock.pluginsContent.normalize(); @@ -1600,12 +1575,7 @@ var BlockManager = function (_Module) { // decrease current block index so that to know current actual this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; - - // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.currentBlock, 0, true); - this.Editor.Toolbar.close(); } /** * Split current Block @@ -2691,7 +2661,7 @@ module.exports = exports["default"]; /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(Module, _, $) { +/* WEBPACK VAR INJECTION */(function(Module, _) { Object.defineProperty(exports, "__esModule", { value: true @@ -2808,14 +2778,11 @@ var Keyboard = function (_Module) { return; } - if (this.Editor.Caret.isAtEnd) { - - /** - * Split the Current Block into two blocks - */ - this.Editor.BlockManager.split(); - event.preventDefault(); - } + /** + * Split the Current Block into two blocks + */ + this.Editor.BlockManager.split(); + event.preventDefault(); } /** @@ -2828,7 +2795,7 @@ var Keyboard = function (_Module) { value: function backSpacePressed(event) { var isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock; + canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock; if (!canMergeBlocks) { @@ -2836,6 +2803,11 @@ var Keyboard = function (_Module) { } this.Editor.BlockManager.mergeBlocks(); + + // set caret to the block without offset at the end + this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); + this.Editor.Toolbar.close(); + event.preventDefault(); } @@ -2868,7 +2840,7 @@ var Keyboard = function (_Module) { Keyboard.displayName = 'Keyboard'; exports.default = Keyboard; module.exports = exports['default']; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1), __webpack_require__(2))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1))) /***/ }), /* 12 */ diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index de6b15a7b..224337d6e 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 3fa18ff14e4c75b6069d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","mayContainMedia","foundMediaContent","join","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","html","selectRange","getRangeAt","extractedBlock","deleteContents","range","cloneRange","selectNodeContents","extractContents","normalize","removeBlock","index","remove","currentNode","Toolbar","close","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","offset","atEnd","focus","nodeToSet","delay","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","blockElem","endContainer","endOffset","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","isAtEnd","split","preventDefault","canMergeBlocks","hasMediaContent","isAtStart","mergeBlocks","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IA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F,gB,EAAkB;;AAEzB,gBAAIlN,QAAQ,EAAZ;AAAA,gBACIqN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAanJ,KAAb,EAAuB;;AAE5C;AACA1M,wBAAQqH,GAAR,UAAgBwO,WAAWnH,IAA3B,uBAAgDmH,UAAhD;AACAF,6BAAaE,WAAWtG,IAAxB;AACAjH,sBAAMvC,IAAN,CAAW8P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBsO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHvG,sBAAU,CAAC,IAAIwG,IAAJ,EADR;AAEHzN,uBAAUA,KAFP;AAGH0N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAYmN,OAAZ,CAAoBkL,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYuI,KAAZ,CAAkBwS,SAAlB,CAA4B,KAAK/a,MAAL,CAAYyI,YAAZ,CAAyBgD,YAAzB,CAAsCuD,IAAlE,CAArB;AAAA,UACIgM,eAAe,KAAKhb,MAAL,CAAYyI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIsR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAYmN,OAAZ,CAAoBkL,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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CAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3fa18ff14e4c75b6069d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Check passed node if it has IMG, Twitter, iframe or something that could contain media\n * @param target\n */\n static hasMediaContent(target) {\n\n let mayContainMedia = [\n 'IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED'\n ];\n\n let foundMediaContent = target.querySelectorAll(mayContainMedia.join());\n\n return foundMediaContent.length !== 0;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - block to merge\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!$.isEmpty(blockToMerge .html)) {\n\n let selection = Selection.get(),\n selectRange = selection.getRangeAt(0),\n extractedBlock;\n\n selectRange.deleteContents();\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockToMerge .pluginsContent);\n extractedBlock = range.extractContents();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n if (this.Editor.Caret.isAtEnd) {\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap a6c01c6b2d2c57f2c290","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","index","remove","currentNode","html","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,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,CAAzB;AAEH;AAEJ;;AAED;;;AAGA,gBAAI,CAAC9I,OAAO8I,YAAZ,EAA0B;;AAEtB,qBAAK,KAAK9I,MAAL,CAAY8I,YAAjB,IAAiC,KAAK9I,MAAL,CAAYsJ,KAA7C;AAAoD;AAApD;AAEH,aAJD,MAIO;;AAEH,qBAAKtJ,MAAL,CAAY8I,YAAZ,GAA2B9I,OAAO8I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK9I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC0J,QAAQ1H,SAAR,CAAkB2H,OAAvB,EACID,QAAQ1H,SAAR,CAAkB2H,OAAlB,GAA4BD,QAAQ1H,SAAR,CAAkB4H,iBAAlB,IACxBF,QAAQ1H,SAAR,CAAkB6H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ1H,SAAR,CAAkB8H,OAAvB,EACIJ,QAAQ1H,SAAR,CAAkB8H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI9F,KAAK,IAAT;;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AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT1V,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK2V,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAItL,SAAS,KAAKlK,MAAL,CAAYsI,YAAZ,CAAyB4B,MAAtC;AAAA,gBACI9I,YAAY,EADhB;;AAGA8I,mBAAO1F,OAAP,CAAe,UAACoG,KAAD,EAAW;;AAEt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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKza,MAAL,CAAYsS,OAAZ,CAAoBuF,IAApB;AACA,WAAK7X,MAAL,CAAYsS,OAAZ,CAAoByF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK/X,MAAL,CAAYsS,OAAZ,CAAoB2F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK1a,MAAL,CAAYoI,KAAZ,CAAkBuS,SAAlB,CAA4B,KAAK3a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsC8C,IAAlE,CAArB;AAAA,UACIwM,eAAe,KAAK5a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIqR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK5a,MAAL,CAAYsS,OAAZ,CAAoB2F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a6c01c6b2d2c57f2c290","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index c2a512952..a22a70e4f 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -149,22 +149,6 @@ export default class Dom { } - /** - * Check passed node if it has IMG, Twitter, iframe or something that could contain media - * @param target - */ - static hasMediaContent(target) { - - let mayContainMedia = [ - 'IMG', 'IFRAME', 'TWITTER', 'VIDEO', 'SOURCE', 'EMBED' - ]; - - let foundMediaContent = target.querySelectorAll(mayContainMedia.join()); - - return foundMediaContent.length !== 0; - - } - /** * Checks node if it is empty * diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 53a353072..554cf2a05 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -187,7 +187,7 @@ export default class BlockManager extends Module { /** * Merge two blocks - * @param {Block} targetBlock - block to merge + * @param {Block} targetBlock - previous block will be append to this block * @param {Block} blockToMerge - block that will be merged with target block */ mergeBlocks(targetBlock, blockToMerge ) { @@ -204,18 +204,9 @@ export default class BlockManager extends Module { } - if (!$.isEmpty(blockToMerge .html)) { + if (!blockToMerge.isEmpty) { - let selection = Selection.get(), - selectRange = selection.getRangeAt(0), - extractedBlock; - - selectRange.deleteContents(); - - let range = selectRange.cloneRange(true); - - range.selectNodeContents(blockToMerge .pluginsContent); - extractedBlock = range.extractContents(); + let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition(); targetBlock.pluginsContent.appendChild(extractedBlock); targetBlock.pluginsContent.normalize(); @@ -236,13 +227,8 @@ export default class BlockManager extends Module { // decrease current block index so that to know current actual this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; - // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.currentBlock, 0, true); - this.Editor.Toolbar.close(); - } /** * Split current Block diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 69e388a94..a10e0d73c 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -94,15 +94,12 @@ export default class Keyboard extends Module { } - if (this.Editor.Caret.isAtEnd) { - /** - * Split the Current Block into two blocks - */ - this.Editor.BlockManager.split(); - event.preventDefault(); - - } + /** + * Split the Current Block into two blocks + */ + this.Editor.BlockManager.split(); + event.preventDefault(); } @@ -113,7 +110,7 @@ export default class Keyboard extends Module { backSpacePressed(event) { let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = !$.hasMediaContent(event.target) && this.Editor.Caret.isAtStart && !isFirstBlock; + canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock; if (!canMergeBlocks) { @@ -122,6 +119,11 @@ export default class Keyboard extends Module { } this.Editor.BlockManager.mergeBlocks(); + + // set caret to the block without offset at the end + this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); + this.Editor.Toolbar.close(); + event.preventDefault(); From 3ebf4992def626666c9d45514fb90401500bd732 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Thu, 24 May 2018 20:57:11 +0300 Subject: [PATCH 07/33] caret behaviour improved --- build/codex-editor.js | 27 +++++++++++++++++------ build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 30 ++++++++++++++++++++------ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 5f69cc0ee..024019494 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1466,10 +1466,18 @@ var BlockManager = function (_Module) { key: 'navigateNext', value: function navigateNext() { - var lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), - textNodeLength = lastTextNode.length; + var lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), + textNodeLength = void 0; - if (_Selection2.default.getAnchorNode() !== lastTextNode) { + if (lastNode.nodeType === Node.ELEMENT_NODE) { + + textNodeLength = lastNode.textContent.length; + } else { + + textNodeLength = lastNode.length; + } + + if (_Selection2.default.getAnchorNode() !== lastNode) { return; } @@ -1560,6 +1568,10 @@ var BlockManager = function (_Module) { } this.removeBlock(this.currentBlockIndex); + + // decrease current block index so that to know current actual + this.currentBlockIndex--; + this.currentNode = this._blocks[this.currentBlockIndex].html; } /** @@ -1572,10 +1584,6 @@ var BlockManager = function (_Module) { value: function removeBlock(index) { this._blocks.remove(index); - - // decrease current block index so that to know current actual - this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; } /** * Split current Block @@ -1599,6 +1607,11 @@ var BlockManager = function (_Module) { text: wrapper.innerHTML }; + if (this.currentBlock.isEmpty) { + + this.currentBlock.pluginsContent.innerHTML = ''; + } + this.insert(this.config.initialBlock, data); } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 224337d6e..fb6a505ba 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap a6c01c6b2d2c57f2c290","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastTextNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","index","remove","currentNode","html","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","lastNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM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AAL,GAAqB5U,MAArB;AAEH;AAEJ;;;8BAkCYkV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCnV,M;;;kBAAlB4U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,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AEHxN,uBAAUA,KAFP;AAGHyN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAET0J,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKnM,KAAL,CAAWuC,OAAX,GAAqBtB,EAAE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;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bta,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B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nD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a6c01c6b2d2c57f2c290","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength = lastTextNode.length;\n\n if (Selection.getAnchorNode() !== lastTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 20d427fb5b9604879590","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;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AACAF,6BAAaE,WAAW7G,IAAxB;AACAxG,sBAAMvC,IAAN,CAAW4P,WAAWtU,IAAtB;AAEH,aAPD;;AASAlB,oBAAQkH,GAAR,CAAY,OAAZ,EAAqBoO,SAArB;AACAtV,oBAAQyV,QAAR;;AAEA,mBAAO;AACH9G,sBAAU,CAAC,IAAI+G,IAAJ,EADR;AAEHvN,uBAAUA,KAFP;AAGHwN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BvW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;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ACIuM,eAAe,KAAK3a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIoR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK3a,MAAL,CAAYqS,OAAZ,CAAoB2F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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BAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 20d427fb5b9604879590","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 554cf2a05..6ff97d309 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -121,10 +121,20 @@ export default class BlockManager extends Module { */ navigateNext() { - let lastTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), - textNodeLength = lastTextNode.length; + let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), + textNodeLength; - if (Selection.getAnchorNode() !== lastTextNode) { + if (lastNode.nodeType === Node.ELEMENT_NODE) { + + textNodeLength = lastNode.textContent.length; + + } else { + + textNodeLength = lastNode.length; + + } + + if (Selection.getAnchorNode() !== lastNode) { return; @@ -215,6 +225,10 @@ export default class BlockManager extends Module { this.removeBlock(this.currentBlockIndex); + // decrease current block index so that to know current actual + this.currentBlockIndex--; + this.currentNode = this._blocks[this.currentBlockIndex].html; + } /** @@ -225,10 +239,6 @@ export default class BlockManager extends Module { this._blocks.remove(index); - // decrease current block index so that to know current actual - this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; - } /** * Split current Block @@ -249,6 +259,12 @@ export default class BlockManager extends Module { text: wrapper.innerHTML, }; + if (this.currentBlock.isEmpty) { + + this.currentBlock.pluginsContent.innerHTML = ''; + + } + this.insert(this.config.initialBlock, data); } From b61fac8386ac101985d3ce7a27fe2a75586ab42f Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Thu, 24 May 2018 21:05:46 +0300 Subject: [PATCH 08/33] up --- build/codex-editor.js | 2 +- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 024019494..37c96fb22 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1604,7 +1604,7 @@ var BlockManager = function (_Module) { * @todo make object in accordance with Tool */ var data = { - text: wrapper.innerHTML + text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML }; if (this.currentBlock.isEmpty) { diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index fb6a505ba..7e6ff466f 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 20d427fb5b9604879590","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE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AEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC0J,QAAQ1H,SAAR,CAAkB2H,OAAvB,EACID,QAAQ1H,SAAR,CAAkB2H,OAAlB,GAA4BD,QAAQ1H,SAAR,CAAkB4H,iBAAlB,IACxBF,QAAQ1H,SAAR,CAAkB6H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ1H,SAAR,CAAkB8H,OAAvB,EACIJ,QAAQ1H,SAAR,CAAkB8H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI9F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS8F,eAAT,CAAyBC,QAAzB,CAAkChG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG0F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO9F,EAAP;AACnBA,aAAKA,GAAGiG,aAAH,IAAoBjG,GAAGkG,UAA5B;AAEH,KALD,QAKSlG,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKxa,MAAL,CAAYqS,OAAZ,CAAoBuF,IAApB;AACA,WAAK5X,MAAL,CAAYqS,OAAZ,CAAoByF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK9X,MAAL,CAAYqS,OAAZ,CAAoB2F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKza,MAAL,CAAYoI,KAAZ,CAAkBsS,SAAlB,CAA4B,KAAK1a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsC8C,IAAlE,CAArB;AAAA,UACIuM,eAAe,KAAK3a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIoR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK3a,MAAL,CAAYqS,OAAZ,CAAoB2F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 20d427fb5b9604879590","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap ea57ef0547964810a656","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uB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Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkClV,M;;;kBAAlB2U,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;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H;;;;EAtE8BvW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAETyJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKlM,KAAL,CAAWuC,OAAX,GAAqBtB,EAAEuB,IAAF,CAAO,KAAP,EAAcuJ,cAAcjJ,GAAd,CAAkBP,OAA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zE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB0I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa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A;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ea57ef0547964810a656","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 6ff97d309..83f85d445 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -256,7 +256,7 @@ export default class BlockManager extends Module { * @todo make object in accordance with Tool */ let data = { - text: wrapper.innerHTML, + text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML, }; if (this.currentBlock.isEmpty) { From 550e3cec20920baa890b4d7c57ab2cee2cc7653f Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Thu, 24 May 2018 21:19:22 +0300 Subject: [PATCH 09/33] up --- build/codex-editor.js | 9 +++++++-- build/codex-editor.js.map | 2 +- src/components/dom.js | 8 +++++++- src/components/modules/caret.js | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 37c96fb22..77d1b9c6e 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -534,7 +534,7 @@ var Dom = function () { * * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node - * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it + * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it */ }, { @@ -547,6 +547,11 @@ var Dom = function () { var nodeChild = atLast ? node.lastChild : node.firstChild; + if (nodeChild.tagName === 'BR') { + + nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling; + } + return this.getDeepestNode(nodeChild, atLast); } @@ -2535,7 +2540,7 @@ var Caret = function (_Module) { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); - return anchorNode === firstNode && selection.anchorOffset === 0; + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; } /** diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 7e6ff466f..60d03c25a 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap ea57ef0547964810a656","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","parentNode","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,Q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AQuV,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBjR,OAAjB,CAAyB,UAACsR,UAAD,EAAatJ,KAAb,EAAuB;;AAE5C;AACAlM,wBAAQkH,GAAR,UAAgBsO,WAAW1H,IAA3B,uBAAgD0H,UAAhD;AACAF,6BAAaE,WAAW7G,IAAxB;AACAxG,sBAAMvC,IAAN,CAAW4P,WAAWtU,IAAtB;AAEH,aAPD;;AASAlB,oBAAQkH,GAAR,CAAY,OAAZ,EAAqBoO,SAArB;AACAtV,oBAAQyV,QAAR;;AAEA,mBAAO;AACH9G,sBAAU,CAAC,IAAI+G,IAAJ,EADR;AAEHvN,uBAAUA,KAFP;AAGHwN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BvW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKza,MAAL,CAAYoI,KAAZ,CAAkBsS,SAAlB,CAA4B,KAAK1a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsC8C,IAAlE,CAArB;AAAA,UACIuM,eAAe,KAAK3a,MAAL,CAAYsI,YAAZ,CAAyBgD,YAAzB,CAAsCjC,OADzD;;AAGA,UAAIoR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK3a,MAAL,CAAYqS,OAAZ,CAAoB2F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ea57ef0547964810a656","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 112cb072a01f0f3e89d5","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mapp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jB,IAAiC,KAAK/I,MAAL,CAAYuJ,KAA7C;AAAoD;AAApD;AAEH,aAJD,MAIO;;AAEH,qBAAKvJ,MAAL,CAAY+I,YAAZ,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA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;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATzV,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0V,MA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAETyJ,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKlM,KAAL,CAAWuC,OAAX,GAAqBtB,EAAEuB,IAAF,CAAO,KAAP,EAAcuJ,cAAcjJ,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAKvC,KAAL,CAAWgM,YAAX,GAA0B/K,EAAEuB,IAAF,CAAO,KAAP,EAAcuJ,cAAcjJ,GAAd,CAAkBkJ,YAAhC,CAA1B;AACA,iBAAKhM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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB2I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBA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;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 112cb072a01f0f3e89d5","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index a22a70e4f..7299f8f3a 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -105,7 +105,7 @@ export default class Dom { * * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node - * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it + * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it */ static getDeepestNode(node, atLast = false) { @@ -113,6 +113,12 @@ export default class Dom { let nodeChild = atLast ? node.lastChild : node.firstChild; + if (nodeChild.tagName === 'BR') { + + nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling; + + } + return this.getDeepestNode(nodeChild, atLast); } diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index ea7cb3fcd..e3623154e 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -154,7 +154,7 @@ export default class Caret extends Module { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); - return anchorNode === firstNode && selection.anchorOffset === 0; + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; } From 0d8257e0926b5c23b0e492f640c9bccb89ed23fc Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 12:32:57 +0300 Subject: [PATCH 10/33] merging blocks. Now plugins handles this cases --- build/codex-editor.js | 100 ++++++++++++++++++------- build/codex-editor.js.map | 2 +- example/plugins/text/text.js | 12 +++ src/components/block.js | 14 ++++ src/components/modules/blockManager.js | 53 ++++++++----- src/components/modules/keyboard.js | 30 ++++++-- 6 files changed, 158 insertions(+), 53 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 77d1b9c6e..acb2aac00 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1548,35 +1548,28 @@ var BlockManager = function (_Module) { * Merge two blocks * @param {Block} targetBlock - previous block will be append to this block * @param {Block} blockToMerge - block that will be merged with target block + * + * @return {Promise} - the sequence that can be continued */ }, { key: 'mergeBlocks', value: function mergeBlocks(targetBlock, blockToMerge) { + var _this4 = this; - if (!targetBlock) { - - targetBlock = this._blocks[this.currentBlockIndex - 1]; - } - - if (!blockToMerge) { - - blockToMerge = this._blocks[this.currentBlockIndex]; - } - - if (!blockToMerge.isEmpty) { + var blockToMergeIndex = this.getBlockIndex(blockToMerge); - var extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition(); + if (blockToMerge.isEmpty) { - targetBlock.pluginsContent.appendChild(extractedBlock); - targetBlock.pluginsContent.normalize(); + this.removeBlock(blockToMergeIndex); + return Promise.resolve(); } - this.removeBlock(this.currentBlockIndex); + return blockToMerge.data.then(function (blockToMergeInfo) { - // decrease current block index so that to know current actual - this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; + targetBlock.mergeWith(blockToMergeInfo.data); + _this4.removeBlock(blockToMergeIndex); + }); } /** @@ -1644,14 +1637,35 @@ var BlockManager = function (_Module) { */ }, { - key: 'getBlockByIndex', + key: 'getBlockIndex', + /** + * Returns block's index + * @param {Block} block + * @return {Number} + */ + value: function getBlockIndex(block) { + + for (var i = 0; i < this._blocks.length; i++) { + + if (this._blocks[i] === block) { + + return i; + } + } + + return -1; + } + /** * Returns Block by passed index * @param {Number} index * @return {Block} */ + + }, { + key: 'getBlockByIndex', value: function getBlockByIndex(index) { return this._blocks[index]; @@ -2182,16 +2196,31 @@ var Block = function () { */ }, { - key: 'save', + key: 'mergeWith', + /** + * Call plugins merge method + * @param {Object} data + */ + value: function mergeWith(data) { + var _this = this; + + return Promise.resolve().then(function () { + + _this.tool.merge(data); + }); + } /** * Extracts data from Block * Groups Tool's save processing time * @return {Object} */ + + }, { + key: 'save', value: function save() { - var _this = this; + var _this2 = this; var extractedBlock = this.tool.save(this.pluginsContent); @@ -2205,7 +2234,7 @@ var Block = function () { measuringEnd = window.performance.now(); return { - tool: _this.name, + tool: _this2.name, data: finishedExtraction, time: measuringEnd - measuringStart }; @@ -2811,6 +2840,7 @@ var Keyboard = function (_Module) { }, { key: 'backSpacePressed', value: function backSpacePressed(event) { + var _this2 = this; var isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock; @@ -2820,13 +2850,29 @@ var Keyboard = function (_Module) { return; } - this.Editor.BlockManager.mergeBlocks(); + // preventing browser default behaviour + event.preventDefault(); + + var targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), + blockToMerge = this.Editor.BlockManager.currentBlock; - // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); - this.Editor.Toolbar.close(); + if (blockToMerge.name !== targetBlock.name) { - event.preventDefault(); + this.Editor.BlockManager.navigatePrevious(); + } + + this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge).then(function () { + + // decrease current block index so that to know current actual + _this2.Editor.BlockManager.currentBlockIndex--; + + window.setTimeout(function () { + + // set caret to the block without offset at the end + _this2.Editor.Caret.setToBlock(_this2.Editor.BlockManager.currentBlock, 0, true); + _this2.Editor.Toolbar.close(); + }, 10); + }); } /** diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 60d03c25a..b43221fa4 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 112cb072a01f0f3e89d5","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","extractedBlock","extractFragmentFromCaretPosition","normalize","removeBlock","currentNode","html","index","remove","extractedFragment","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","Error","isLastBlock","isFirstBlock","array","selected","workingArea","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","mergeBlocks","Toolbar","close","navigateNext","navigatePrevious","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AA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P,WAAWtU,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBmO,SAArB;AACAtV,oBAAQyV,QAAR;;AAEA,mBAAO;AACH9G,sBAAU,CAAC,IAAI+G,IAAJ,EADR;AAEHtN,uBAAUA,KAFP;AAGHuN,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BvW,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB0V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAETyJ,0B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B,CAAsChC,OADzD;;AAGA,UAAImR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK3a,MAAL,CAAYqS,OAAZ,CAAoB2F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bra,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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B,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 112cb072a01f0f3e89d5","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n */\n mergeBlocks(targetBlock, blockToMerge ) {\n\n if (!targetBlock) {\n\n targetBlock = this._blocks[this.currentBlockIndex - 1];\n\n }\n\n if (!blockToMerge ) {\n\n blockToMerge = this._blocks[this.currentBlockIndex];\n\n }\n\n if (!blockToMerge.isEmpty) {\n\n let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition();\n\n targetBlock.pluginsContent.appendChild(extractedBlock);\n targetBlock.pluginsContent.normalize();\n\n }\n\n this.removeBlock(this.currentBlockIndex);\n\n // decrease current block index so that to know current actual\n this.currentBlockIndex--;\n this.currentNode = this._blocks[this.currentBlockIndex].html;\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n this.Editor.BlockManager.mergeBlocks();\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n event.preventDefault();\n\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap aaf19dcc0715f3c0eae8","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","getBlockIndex","removeBlock","blockToMergeInfo","mergeWith","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","i","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA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AKvJ,MAAL,CAAY+I,YAAZ,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG2F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO/F,EAAP;AACnBA,aAAKA,GAAGkG,aAA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,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW5H,IAA3B,uBAAgD4H,UAAhD;AACAF,6BAAaE,WAAW7G,IAAxB;AACA5G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACH9G,sBAAU,CAAC,IAAI+G,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsCiD,IAAlE,CAArB;AAAA,UACIyM,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap aaf19dcc0715f3c0eae8","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this.getBlockIndex(blockToMerge);\n\n if (blockToMerge.isEmpty) {\n\n this.removeBlock(blockToMergeIndex);\n return Promise.resolve();\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n this.removeBlock(blockToMergeIndex);\n\n });\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns block's index\n * @param {Block} block\n * @return {Number}\n */\n getBlockIndex(block) {\n\n for(let i = 0; i < this._blocks.length; i++) {\n\n if (this._blocks[i] === block) {\n\n return i;\n\n }\n\n }\n\n return -1;\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then( () => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/example/plugins/text/text.js b/example/plugins/text/text.js index d93ccf71a..86f110f97 100644 --- a/example/plugins/text/text.js +++ b/example/plugins/text/text.js @@ -83,6 +83,18 @@ class Text { } + /** + * Merge current data with passed data + * @param {TextData} data + */ + merge(data) { + let newData = { + text : this.data.text + data.text + }; + + this.data = newData; + } + /** * Check if saved text is empty * diff --git a/src/components/block.js b/src/components/block.js index ec9e56ec3..f86c422cb 100644 --- a/src/components/block.js +++ b/src/components/block.js @@ -104,6 +104,20 @@ export default class Block { } + /** + * Call plugins merge method + * @param {Object} data + */ + mergeWith(data) { + + return Promise.resolve() + .then( () => { + + this.tool.merge(data); + + }); + + } /** * Extracts data from Block * Groups Tool's save processing time diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 83f85d445..c9ab1e7cc 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -199,35 +199,27 @@ export default class BlockManager extends Module { * Merge two blocks * @param {Block} targetBlock - previous block will be append to this block * @param {Block} blockToMerge - block that will be merged with target block + * + * @return {Promise} - the sequence that can be continued */ - mergeBlocks(targetBlock, blockToMerge ) { - - if (!targetBlock) { - - targetBlock = this._blocks[this.currentBlockIndex - 1]; + mergeBlocks(targetBlock, blockToMerge) { - } + let blockToMergeIndex = this.getBlockIndex(blockToMerge); - if (!blockToMerge ) { + if (blockToMerge.isEmpty) { - blockToMerge = this._blocks[this.currentBlockIndex]; + this.removeBlock(blockToMergeIndex); + return Promise.resolve(); } - if (!blockToMerge.isEmpty) { - - let extractedBlock = this.Editor.Caret.extractFragmentFromCaretPosition(); - - targetBlock.pluginsContent.appendChild(extractedBlock); - targetBlock.pluginsContent.normalize(); + return blockToMerge.data + .then((blockToMergeInfo) => { - } - - this.removeBlock(this.currentBlockIndex); + targetBlock.mergeWith(blockToMergeInfo.data); + this.removeBlock(blockToMergeIndex); - // decrease current block index so that to know current actual - this.currentBlockIndex--; - this.currentNode = this._blocks[this.currentBlockIndex].html; + }); } @@ -293,6 +285,27 @@ export default class BlockManager extends Module { } + /** + * Returns block's index + * @param {Block} block + * @return {Number} + */ + getBlockIndex(block) { + + for(let i = 0; i < this._blocks.length; i++) { + + if (this._blocks[i] === block) { + + return i; + + } + + } + + return -1; + + } + /** * Returns Block by passed index * @param {Number} index diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index a10e0d73c..08fd25a06 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -118,14 +118,34 @@ export default class Keyboard extends Module { } - this.Editor.BlockManager.mergeBlocks(); + // preventing browser default behaviour + event.preventDefault(); - // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); - this.Editor.Toolbar.close(); + let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), + blockToMerge = this.Editor.BlockManager.currentBlock; - event.preventDefault(); + if (blockToMerge.name !== targetBlock.name) { + + this.Editor.BlockManager.navigatePrevious(); + + } + + this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge) + .then( () => { + + // decrease current block index so that to know current actual + this.Editor.BlockManager.currentBlockIndex--; + + window.setTimeout( () => { + + // set caret to the block without offset at the end + this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); + this.Editor.Toolbar.close(); + + }, 10); + + }); } From e2041c9375711bba3bf0a0fdb074a9605351a868 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 12:52:56 +0300 Subject: [PATCH 11/33] mergeable getter --- build/codex-editor.js | 17 +++++++++++++++-- build/codex-editor.js.map | 2 +- src/components/block.js | 11 +++++++++++ src/components/modules/blockManager.js | 2 +- src/components/modules/keyboard.js | 2 +- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index acb2aac00..5b1793da9 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1557,7 +1557,7 @@ var BlockManager = function (_Module) { value: function mergeBlocks(targetBlock, blockToMerge) { var _this4 = this; - var blockToMergeIndex = this.getBlockIndex(blockToMerge); + var blockToMergeIndex = this._blocks.indexOf(blockToMerge); if (blockToMerge.isEmpty) { @@ -2296,6 +2296,19 @@ var Block = function () { return this.save(); } + + /** + * is block mergeable + * We plugin have merge function then we call it mergable + * @return {boolean} + */ + + }, { + key: 'mergeable', + get: function get() { + + return !!(this.tool.merge && typeof this.tool.merge === 'function'); + } }, { key: 'isEmpty', get: function get() { @@ -2856,7 +2869,7 @@ var Keyboard = function (_Module) { var targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), blockToMerge = this.Editor.BlockManager.currentBlock; - if (blockToMerge.name !== targetBlock.name) { + if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) { this.Editor.BlockManager.navigatePrevious(); } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index b43221fa4..effde385e 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap aaf19dcc0715f3c0eae8","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","getBlockIndex","removeBlock","blockToMergeInfo","mergeWith","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","i","firstLevelBlock","CSS","indexOf","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","cl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,OAAO+I,YAAZ,EAA0B;;AAEtB,qBAAK,KAAK/I,MAAL,CAAY+I,YAAjB,IAAiC,KAAK/I,MAAL,CAAYuJ,KAA7C;AAAoD;AAApD;AAEH,aAJD,MAIO;;AAEH,qBAAKvJ,MAAL,CAAY+I,YAAZ,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CA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,UAAL,CAAgBD,gBAAhB,CAAtB;AAAA,aADH,EAEF7U,IAFE,CAEG,UAAC+U,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW5H,IAA3B,uBAAgD4H,UAAhD;AACAF,6BAAaE,WAAW7G,IAAxB;AACA5G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACH9G,sBAAU,CAAC,IAAI+G,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK7a,MAAL,CAAY4S,OAAZ,CAAoBqF,IAApB;AACA,WAAKjY,MAAL,CAAY4S,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsCiD,IAAlE,CAArB;AAAA,UACIyM,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB2I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap aaf19dcc0715f3c0eae8","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this.getBlockIndex(blockToMerge);\n\n if (blockToMerge.isEmpty) {\n\n this.removeBlock(blockToMergeIndex);\n return Promise.resolve();\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n this.removeBlock(blockToMergeIndex);\n\n });\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns block's index\n * @param {Block} block\n * @return {Number}\n */\n getBlockIndex(block) {\n\n for(let i = 0; i < this._blocks.length; i++) {\n\n if (this._blocks[i] === block) {\n\n return i;\n\n }\n\n }\n\n return -1;\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then( () => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 98355eca3a3adafbf276","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","removeBlock","blockToMergeInfo","mergeWith","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","i","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,Q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AEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW7H,IAA3B,uBAAgD6H,UAAhD;AACAF,6BAAaE,WAAW9G,IAAxB;AACA3G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACH/G,sBAAU,CAAC,IAAIgH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB+V,K;;;;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BAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsCgD,IAAlE,CAArB;AAAA,UACI0M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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A8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 98355eca3a3adafbf276","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n \n if (blockToMerge.isEmpty) {\n\n this.removeBlock(blockToMergeIndex);\n return Promise.resolve();\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n this.removeBlock(blockToMergeIndex);\n\n });\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns block's index\n * @param {Block} block\n * @return {Number}\n */\n getBlockIndex(block) {\n\n for(let i = 0; i < this._blocks.length; i++) {\n\n if (this._blocks[i] === block) {\n\n return i;\n\n }\n\n }\n\n return -1;\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then( () => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/block.js b/src/components/block.js index f86c422cb..8cc8faa24 100644 --- a/src/components/block.js +++ b/src/components/block.js @@ -104,6 +104,17 @@ export default class Block { } + /** + * is block mergeable + * We plugin have merge function then we call it mergable + * @return {boolean} + */ + get mergeable() { + + return !!(this.tool.merge && typeof this.tool.merge === 'function'); + + } + /** * Call plugins merge method * @param {Object} data diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index c9ab1e7cc..cfa7cdd4c 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -204,7 +204,7 @@ export default class BlockManager extends Module { */ mergeBlocks(targetBlock, blockToMerge) { - let blockToMergeIndex = this.getBlockIndex(blockToMerge); + let blockToMergeIndex = this._blocks.indexOf(blockToMerge); if (blockToMerge.isEmpty) { diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 08fd25a06..9d7be2572 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -125,7 +125,7 @@ export default class Keyboard extends Module { blockToMerge = this.Editor.BlockManager.currentBlock; - if (blockToMerge.name !== targetBlock.name) { + if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) { this.Editor.BlockManager.navigatePrevious(); From c92f3f9af1787c0ef8e1bc2dc6da493d9ddbfd27 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 13:36:40 +0300 Subject: [PATCH 12/33] save --- build/codex-editor.js | 58 +++++++++----------------- build/codex-editor.js.map | 2 +- src/components/block.js | 2 +- src/components/modules/blockManager.js | 54 +++++++++--------------- src/components/modules/keyboard.js | 8 ++-- 5 files changed, 44 insertions(+), 80 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 5b1793da9..a3cb6e3b9 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1559,15 +1559,21 @@ var BlockManager = function (_Module) { var blockToMergeIndex = this._blocks.indexOf(blockToMerge); - if (blockToMerge.isEmpty) { + return new Promise(function (resolve) { - this.removeBlock(blockToMergeIndex); - return Promise.resolve(); - } + if (blockToMerge.isEmpty) { - return blockToMerge.data.then(function (blockToMergeInfo) { + resolve(); + } else { + + blockToMerge.data.then(function (blockToMergeInfo) { + + targetBlock.mergeWith(blockToMergeInfo.data); + resolve(); + }); + } + }).then(function () { - targetBlock.mergeWith(blockToMergeInfo.data); _this4.removeBlock(blockToMergeIndex); }); } @@ -1602,14 +1608,9 @@ var BlockManager = function (_Module) { * @todo make object in accordance with Tool */ var data = { - text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML + text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML }; - if (this.currentBlock.isEmpty) { - - this.currentBlock.pluginsContent.innerHTML = ''; - } - this.insert(this.config.initialBlock, data); } @@ -1637,35 +1638,14 @@ var BlockManager = function (_Module) { */ }, { - key: 'getBlockIndex', - - - /** - * Returns block's index - * @param {Block} block - * @return {Number} - */ - value: function getBlockIndex(block) { - - for (var i = 0; i < this._blocks.length; i++) { - - if (this._blocks[i] === block) { - - return i; - } - } + key: 'getBlockByIndex', - return -1; - } /** * Returns Block by passed index * @param {Number} index * @return {Block} */ - - }, { - key: 'getBlockByIndex', value: function getBlockByIndex(index) { return this._blocks[index]; @@ -2778,7 +2758,7 @@ var Keyboard = function (_Module) { case _.keyCodes.BACKSPACE: _.log('Backspace key pressed'); - this.backSpacePressed(event); + this.backspacePressed(event); break; case _.keyCodes.ENTER: @@ -2851,12 +2831,12 @@ var Keyboard = function (_Module) { */ }, { - key: 'backSpacePressed', - value: function backSpacePressed(event) { + key: 'backspacePressed', + value: function backspacePressed(event) { var _this2 = this; var isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock; + canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock; if (!canMergeBlocks) { @@ -2869,7 +2849,7 @@ var Keyboard = function (_Module) { var targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), blockToMerge = this.Editor.BlockManager.currentBlock; - if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) { + if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) { this.Editor.BlockManager.navigatePrevious(); } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index effde385e..fc83266bc 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 98355eca3a3adafbf276","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","removeBlock","blockToMergeInfo","mergeWith","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","i","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backSpacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,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A7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG2F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO/F,EAAP;AACnBA,aAAKA,GAAGkG,aAAH,IAAoBlG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AFE,CAEG,UAAC+U,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW7H,IAA3B,uBAAgD6H,UAAhD;AACAF,6BAAaE,WAAW9G,IAAxB;AACA3G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACH/G,sBAAU,CAAC,IAAIgH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AAY4S,OAAZ,CAAoBqF,IAApB;AACA,WAAKjY,MAAL,CAAY4S,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsCgD,IAAlE,CAArB;AAAA,UACI0M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY4S,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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BAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 98355eca3a3adafbf276","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n \n if (blockToMerge.isEmpty) {\n\n this.removeBlock(blockToMergeIndex);\n return Promise.resolve();\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n this.removeBlock(blockToMergeIndex);\n\n });\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML,\n };\n\n if (this.currentBlock.isEmpty) {\n\n this.currentBlock.pluginsContent.innerHTML = '';\n\n }\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns block's index\n * @param {Block} block\n * @return {Number}\n */\n getBlockIndex(block) {\n\n for(let i = 0; i < this._blocks.length; i++) {\n\n if (this._blocks[i] === block) {\n\n return i;\n\n }\n\n }\n\n return -1;\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then( () => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backSpacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backSpacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap fee56c8538053d5cd1fd","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG2F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO/F,EAAP;AACnBA,aAAKA,GAAGkG,aAAH,IAAoBlG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACp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BAArB;AAWH,aAbD,MAaO;;AAEH,qBAAKZ,aAAL,GAAqBhV,MAArB;AAEH;AAEJ;;;8BAkCYsV,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCvV,M;;;kBAAlBgV,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,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O;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB+V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAET8J,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH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;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB2I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6B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ACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fee56c8538053d5cd1fd","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return new Promise((resolve) => {\n\n if (blockToMerge.isEmpty) {\n\n resolve();\n\n } else {\n\n blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n resolve();\n\n });\n\n }\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/block.js b/src/components/block.js index 8cc8faa24..4711ce4fc 100644 --- a/src/components/block.js +++ b/src/components/block.js @@ -122,7 +122,7 @@ export default class Block { mergeWith(data) { return Promise.resolve() - .then( () => { + .then(() => { this.tool.merge(data); diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index cfa7cdd4c..76cebaac1 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -206,21 +206,32 @@ export default class BlockManager extends Module { let blockToMergeIndex = this._blocks.indexOf(blockToMerge); - if (blockToMerge.isEmpty) { + return new Promise((resolve) => { - this.removeBlock(blockToMergeIndex); - return Promise.resolve(); + if (blockToMerge.isEmpty) { - } + resolve(); + + } else { + + blockToMerge.data + .then((blockToMergeInfo) => { + + targetBlock.mergeWith(blockToMergeInfo.data); + resolve(); + + }); + + } - return blockToMerge.data - .then((blockToMergeInfo) => { + }) + .then( () => { - targetBlock.mergeWith(blockToMergeInfo.data); this.removeBlock(blockToMergeIndex); }); + } /** @@ -248,15 +259,9 @@ export default class BlockManager extends Module { * @todo make object in accordance with Tool */ let data = { - text: wrapper.textContent.trim() === '' ? '' : wrapper.innerHTML, + text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML, }; - if (this.currentBlock.isEmpty) { - - this.currentBlock.pluginsContent.innerHTML = ''; - - } - this.insert(this.config.initialBlock, data); } @@ -285,27 +290,6 @@ export default class BlockManager extends Module { } - /** - * Returns block's index - * @param {Block} block - * @return {Number} - */ - getBlockIndex(block) { - - for(let i = 0; i < this._blocks.length; i++) { - - if (this._blocks[i] === block) { - - return i; - - } - - } - - return -1; - - } - /** * Returns Block by passed index * @param {Number} index diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 9d7be2572..ed9449d6e 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -34,7 +34,7 @@ export default class Keyboard extends Module { case _.keyCodes.BACKSPACE: _.log('Backspace key pressed'); - this.backSpacePressed(event); + this.backspacePressed(event); break; case _.keyCodes.ENTER: @@ -107,10 +107,10 @@ export default class Keyboard extends Module { * Handle backspace keypress on block * @param event */ - backSpacePressed(event) { + backspacePressed(event) { let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = !this.Editor.BlockManager.currentBlock.hasMedia && this.Editor.Caret.isAtStart && !isFirstBlock; + canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock; if (!canMergeBlocks) { @@ -125,7 +125,7 @@ export default class Keyboard extends Module { blockToMerge = this.Editor.BlockManager.currentBlock; - if (blockToMerge.name !== targetBlock.name || !this.Editor.BlockManager.currentBlock.mergeable) { + if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) { this.Editor.BlockManager.navigatePrevious(); From d969f7d40da738f02bb9541a42c52cc085e760fb Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 14:00:44 +0300 Subject: [PATCH 13/33] up --- build/codex-editor.js | 14 ++++++-------- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 16 +++++++--------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index a3cb6e3b9..889a8c4ec 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1559,19 +1559,17 @@ var BlockManager = function (_Module) { var blockToMergeIndex = this._blocks.indexOf(blockToMerge); - return new Promise(function (resolve) { + return Promise.resolve().then(function () { if (blockToMerge.isEmpty) { - resolve(); - } else { + return; + } - blockToMerge.data.then(function (blockToMergeInfo) { + return blockToMerge.data.then(function (blockToMergeInfo) { - targetBlock.mergeWith(blockToMergeInfo.data); - resolve(); - }); - } + targetBlock.mergeWith(blockToMergeInfo.data); + }); }).then(function () { _this4.removeBlock(blockToMergeIndex); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index fc83266bc..96dcdb52e 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap fee56c8538053d5cd1fd","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,OAAP,CAAgBH,I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AyB,CAAEC,YAAF,CAAzB;AAEH;AAEJ;;AAED;;;AAGA,gBAAI,CAAC/I,OAAO+I,YAAZ,EAA0B;;AAEtB,qBAAK,KAAK/I,MAAL,CAAY+I,YAAjB,IAAiC,KAAK/I,MAAL,CAAYuJ,KAA7C;AAAoD;AAApD;AAEH,aAJD,MAIO;;AAEH,qBAAKvJ,MAAL,CAAY+I,YAAZ,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI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AAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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CAAoBwF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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sB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fee56c8538053d5cd1fd","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return new Promise((resolve) => {\n\n if (blockToMerge.isEmpty) {\n\n resolve();\n\n } else {\n\n blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n resolve();\n\n });\n\n }\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 35f28a4cd291b7273519","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;A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,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG2F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO/F,EAAP;AACnBA,aAAKA,GAAGkG,aAAH,IAAoBlG,GAAGyB,UAA5B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AAgB0O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB+V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT5W,MAAS,QAATA,MA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C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 35f28a4cd291b7273519","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 76cebaac1..a95704749 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -206,25 +206,23 @@ export default class BlockManager extends Module { let blockToMergeIndex = this._blocks.indexOf(blockToMerge); - return new Promise((resolve) => { + return Promise.resolve() + .then( () => { - if (blockToMerge.isEmpty) { + if (blockToMerge.isEmpty) { - resolve(); + return; - } else { + } - blockToMerge.data + return blockToMerge.data .then((blockToMergeInfo) => { targetBlock.mergeWith(blockToMergeInfo.data); - resolve(); }); - } - - }) + }) .then( () => { this.removeBlock(blockToMergeIndex); From 01a1b9676fac2b61ec89f795d4d5ed9e3552b643 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 14:08:56 +0300 Subject: [PATCH 14/33] dom getdeepestnode improvements --- build/codex-editor.js | 15 ++++++++++++--- build/codex-editor.js.map | 2 +- src/components/block.js | 2 +- src/components/dom.js | 16 ++++++++++++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 889a8c4ec..7b24a7a53 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -534,7 +534,7 @@ var Dom = function () { * * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node - * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it + * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it */ }, { @@ -549,7 +549,16 @@ var Dom = function () { if (nodeChild.tagName === 'BR') { - nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling; + if (nodeChild.nextSibling) { + + nodeChild = nodeChild.nextSibling; + } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) { + + nodeChild = nodeChild.parentNode.nextSibling; + } else { + + return nodeChild.parentNode; + } } return this.getDeepestNode(nodeChild, atLast); @@ -2285,7 +2294,7 @@ var Block = function () { key: 'mergeable', get: function get() { - return !!(this.tool.merge && typeof this.tool.merge === 'function'); + return typeof this.tool.merge === 'function'; } }, { key: 'isEmpty', diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 96dcdb52e..0123ab5b3 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 35f28a4cd291b7273519","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AA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AAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT9V,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK+V,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAI1L,SAAS,KAAKlK,M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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB+V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwK,KAAL,GAAa;AACTuC,qBAAS,IADA;AAET8J,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKvM,KAAL,CAAWuC,OAAX,GAAqBtB,EAAEuB,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAKvC,KAAL,CAAWqM,YAAX,GAA0BpL,EAAEuB,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBuJ,YAAhC,CAA1B;AACA,iBAAKrM,KAAL,CAAWsM,eAAX,GAA6BrL,EAAEuB,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBwJ,eAAhC,CAA7B;;AAEArL,cAAEwB,MAAF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;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK7a,MAAL,CAAY2S,OAAZ,CAAoBsF,IAApB;AACA,WAAKjY,MAAL,CAAY2S,OAAZ,CAAoBwF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB2I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBA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DAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 35f28a4cd291b7273519","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling;\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return !!(this.tool.merge && typeof this.tool.merge === 'function');\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap bc82c578118a2e8dc05d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,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H,aAJD,MAIO;;AAEH,qBAAKvJ,MAAL,CAAY+I,YAAZ,GAA2B/I,OAAO+I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK/I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC2J,QAAQ3H,SAAR,CAAkB4H,OAAvB,EACID,QAAQ3H,SAAR,CAAkB4H,OAAlB,GAA4BD,QAAQ3H,SAAR,CAAkB6H,iBAAlB,IACxBF,QAAQ3H,SAAR,CAAkB8H,qBADtB;;AAGJ,IAAI,CAACH,QAAQ3H,SAAR,CAAkB+H,OAAvB,EACIJ,QAAQ3H,SAAR,CAAkB+H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI/F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS+F,eAAT,CAAyBC,QAAzB,CAAkCjG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG2F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO/F,EAAP;A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AAgB0O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB+V,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT5W,MAAS,QAATA,MA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C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap bc82c578118a2e8dc05d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n if (nodeChild.nextSibling) {\n\n nodeChild = nodeChild.nextSibling;\n\n } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) {\n\n nodeChild = nodeChild.parentNode.nextSibling;\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/block.js b/src/components/block.js index 4711ce4fc..37f27e734 100644 --- a/src/components/block.js +++ b/src/components/block.js @@ -111,7 +111,7 @@ export default class Block { */ get mergeable() { - return !!(this.tool.merge && typeof this.tool.merge === 'function'); + return typeof this.tool.merge === 'function'; } diff --git a/src/components/dom.js b/src/components/dom.js index 7299f8f3a..d2b5cc7c8 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -105,7 +105,7 @@ export default class Dom { * * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search} * @param {Boolean} atLast - find last text node - * @return {Node|null} - it can be text Node or Element Node, so that caret will able to work with it + * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it */ static getDeepestNode(node, atLast = false) { @@ -115,7 +115,19 @@ export default class Dom { if (nodeChild.tagName === 'BR') { - nodeChild = nodeChild.nextSibling || nodeChild.parentNode.nextSibling; + if (nodeChild.nextSibling) { + + nodeChild = nodeChild.nextSibling; + + } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) { + + nodeChild = nodeChild.parentNode.nextSibling; + + } else { + + return nodeChild.parentNode; + + } } From fb3e6fd6ee8080f05bb52b42d2061c5b875a2fae Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 14:29:10 +0300 Subject: [PATCH 15/33] improve getDeepest node method one more time --- build/codex-editor.js | 41 ++++++++++++++++++++++++++++++++------- build/codex-editor.js.map | 2 +- src/components/dom.js | 41 ++++++++++++++++++++++++++++++++------- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 7b24a7a53..f0e94b065 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -543,18 +543,39 @@ var Dom = function () { var atLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { + /** + * Current function have two directions: + * - starts from first child and every time gets first or nextSibling in special cases + * - starts from last child and gets last or previousSibling + * @type {string} + */ + var child = atLast ? 'lastChild' : 'firstChild', + sibling = atLast ? 'previousSibling' : 'nextSibling'; - var nodeChild = atLast ? node.lastChild : node.firstChild; + if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { - if (nodeChild.tagName === 'BR') { + var nodeChild = atLast ? node[child] : node[child]; - if (nodeChild.nextSibling) { + /** + * special case when child is single tag that can't contain any content + */ + if (Dom.singleTags.includes(nodeChild.tagName)) { - nodeChild = nodeChild.nextSibling; - } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) { + /** + * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest + * from sibling + * + * 2) If single tag's next sibling is null, then go back to parent and check his sibling + * In case of Node Element continue searching + * + * 3) If none of conditions above happened return parent Node Element + */ + if (nodeChild[sibling]) { + + nodeChild = nodeChild[sibling]; + } else if (nodeChild.parentNode[sibling]) { - nodeChild = nodeChild.parentNode.nextSibling; + nodeChild = nodeChild.parentNode[sibling]; } else { return nodeChild.parentNode; @@ -694,6 +715,12 @@ var Dom = function () { return _this.isNodeEmpty(leaf); }); } + }, { + key: 'singleTags', + get: function get() { + + return ['BR', 'HR', 'IMG']; + } }]); return Dom; diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 0123ab5b3..5cf5824c2 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap bc82c578118a2e8dc05d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","nodeType","Node","ELEMENT_NODE","firstChild","nodeChild","lastChild","nextSibling","parentNode","getDeepestNode","nativeInputs","includes","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","shift","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode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E,CAEG,UAAC+U,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA3V,oBAAQ4V,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBtR,OAAjB,CAAyB,UAAC2R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAjM,wBAAQmH,GAAR,UAAgB0O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMtC,IAAN,CAAW+P,WAAW3U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQmH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA3V,oBAAQ8V,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B5W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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oBsF,IAApB;AACA,WAAKjY,MAAL,CAAY2S,OAAZ,CAAoBwF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKnY,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK9a,MAAL,CAAYqI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAK/a,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKhb,MAAL,CAAYuI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKhb,MAAL,CAAY2S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B1a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap bc82c578118a2e8dc05d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) {\n\n let nodeChild = atLast ? node.lastChild : node.firstChild;\n\n if (nodeChild.tagName === 'BR') {\n\n if (nodeChild.nextSibling) {\n\n nodeChild = nodeChild.nextSibling;\n\n } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) {\n\n nodeChild = nodeChild.parentNode.nextSibling;\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 7fdce4ffb5b1efd5699a","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","singleTags","includes","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA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a5J,KAAb,EAAuB;;AAE5C;AACAnM,wBAAQqH,GAAR,UAAgB0O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMxC,IAAN,CAAWiQ,WAAW7U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA7V,oBAAQgW,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B9W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBiW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc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jb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKlb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKlb,MAAL,CAAY6S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B5a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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A8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7fdce4ffb5b1efd5699a","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static get singleTags() {\n\n return ['BR', 'HR', 'IMG'];\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = atLast ? node[child] : node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.singleTags.includes(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index d2b5cc7c8..db348ab3b 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -3,6 +3,12 @@ */ export default class Dom { + static get singleTags() { + + return ['BR', 'HR', 'IMG']; + + } + /** * Helper for making Elements with classname and attributes * @@ -109,19 +115,40 @@ export default class Dom { */ static getDeepestNode(node, atLast = false) { - if (node && node.nodeType === Node.ELEMENT_NODE && node.firstChild) { + /** + * Current function have two directions: + * - starts from first child and every time gets first or nextSibling in special cases + * - starts from last child and gets last or previousSibling + * @type {string} + */ + let child = atLast ? 'lastChild' : 'firstChild', + sibling = atLast ? 'previousSibling' : 'nextSibling'; + + if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { - let nodeChild = atLast ? node.lastChild : node.firstChild; + let nodeChild = atLast ? node[child] : node[child]; - if (nodeChild.tagName === 'BR') { + /** + * special case when child is single tag that can't contain any content + */ + if (Dom.singleTags.includes(nodeChild.tagName)) { - if (nodeChild.nextSibling) { + /** + * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest + * from sibling + * + * 2) If single tag's next sibling is null, then go back to parent and check his sibling + * In case of Node Element continue searching + * + * 3) If none of conditions above happened return parent Node Element + */ + if (nodeChild[sibling]) { - nodeChild = nodeChild.nextSibling; + nodeChild = nodeChild[sibling]; - } else if (!nodeChild.nextSibling && nodeChild.parentNode.nextSibling) { + } else if (nodeChild.parentNode[sibling]) { - nodeChild = nodeChild.parentNode.nextSibling; + nodeChild = nodeChild.parentNode[sibling]; } else { From b4220c844e3840bf287161394391d0b41e9a4e64 Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Fri, 25 May 2018 17:40:47 +0300 Subject: [PATCH 16/33] upd --- build/codex-editor.js | 26 +++++++++++++++++--------- build/codex-editor.js.map | 2 +- src/components/dom.js | 17 +++++++++++++---- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index f0e94b065..d4caa3e23 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -415,8 +415,11 @@ var Dom = function () { } _createClass(Dom, null, [{ - key: 'make', + key: 'isSingleTag', + value: function isSingleTag(tagName) { + return tagName && ['BR', 'HR', 'IMG'].includes(tagName); + } /** * Helper for making Elements with classname and attributes @@ -426,6 +429,9 @@ var Dom = function () { * @param {Object} attributes - any attributes * @return {Element} */ + + }, { + key: 'make', value: function make(tagName) { var classNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -552,14 +558,15 @@ var Dom = function () { var child = atLast ? 'lastChild' : 'firstChild', sibling = atLast ? 'previousSibling' : 'nextSibling'; + console.log('node is ', node); if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { - var nodeChild = atLast ? node[child] : node[child]; + var nodeChild = node[child]; /** * special case when child is single tag that can't contain any content */ - if (Dom.singleTags.includes(nodeChild.tagName)) { + if (Dom.isSingleTag(nodeChild.tagName)) { /** * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest @@ -585,6 +592,13 @@ var Dom = function () { return this.getDeepestNode(nodeChild, atLast); } + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') { + + var zeroSpaceSymbol = document.createTextNode('\u200B'); + + node.parentNode.appendChild(zeroSpaceSymbol); + } + return node; } @@ -715,12 +729,6 @@ var Dom = function () { return _this.isNodeEmpty(leaf); }); } - }, { - key: 'singleTags', - get: function get() { - - return ['BR', 'HR', 'IMG']; - } }]); return Dom; diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 5cf5824c2..c5c40a8ee 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 7fdce4ffb5b1efd5699a","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","singleTags","includes","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,C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,YAAZ,GAA2BjJ,OAAOiJ,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAKjJ,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GAAG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AF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMxC,IAAN,CAAWiQ,WAAW7U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBwO,SAArB;AACA7V,oBAAQgW,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B9W,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBiW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT9W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;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AL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKlb,MAAL,CAAY6S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B5a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7fdce4ffb5b1efd5699a","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static get singleTags() {\n\n return ['BR', 'HR', 'IMG'];\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = atLast ? node[child] : node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.singleTags.includes(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 035b5e641e17429bdafb","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","log","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","TEXT_NODE","textContent","trim","zeroSpaceSymbol","nativeInputs","nodeText","isElement","isNativeInput","value","replace","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAA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hB,CAAtB;AAAA,aADH,EAEFjV,IAFE,CAEG,UAACmV,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIpN,QAAQ,EAAZ;AAAA,gBACIuN,YAAY,CADhB;;AAGA/V,oBAAQgW,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBzR,OAAjB,CAAyB,UAAC8R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACArM,wBAAQ4E,GAAR,UAAgBqR,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMvC,IAAN,CAAWgQ,WAAW/U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQ4E,GAAR,CAAY,OAAZ,EAAqBmR,SAArB;AACA/V,oBAAQkW,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BhX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAKjb,MAAL,CAAY+S,OAAZ,CAAoBsF,IAApB;AACA,WAAKrY,MAAL,CAAY+S,OAAZ,CAAoBwF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKvY,MAAL,CAAY+S,OAAZ,CAAoB0F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKlb,MAAL,CAAYyI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAKnb,MAAL,CAAY2I,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKpb,MAAL,CAAY2I,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKpb,MAAL,CAAY+S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B9a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 035b5e641e17429bdafb","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n console.log('node is ', node);\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') {\n\n let zeroSpaceSymbol = document.createTextNode('\\u200b');\n\n node.parentNode.appendChild(zeroSpaceSymbol);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.

  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index db348ab3b..fe525a61b 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -3,9 +3,9 @@ */ export default class Dom { - static get singleTags() { + static isSingleTag(tagName) { - return ['BR', 'HR', 'IMG']; + return tagName && ['BR', 'HR', 'IMG'].includes(tagName); } @@ -124,14 +124,15 @@ export default class Dom { let child = atLast ? 'lastChild' : 'firstChild', sibling = atLast ? 'previousSibling' : 'nextSibling'; + console.log('node is ', node); if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { - let nodeChild = atLast ? node[child] : node[child]; + let nodeChild = node[child]; /** * special case when child is single tag that can't contain any content */ - if (Dom.singleTags.includes(nodeChild.tagName)) { + if (Dom.isSingleTag(nodeChild.tagName)) { /** * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest @@ -162,6 +163,14 @@ export default class Dom { } + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') { + + let zeroSpaceSymbol = document.createTextNode('\u200b'); + + node.parentNode.appendChild(zeroSpaceSymbol); + + } + return node; } From 58d640a5d222afdaeaae05fefb22cc6eb2bb31f3 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Fri, 25 May 2018 19:56:10 +0300 Subject: [PATCH 17/33] Deal with it --- build/codex-editor.js | 64 +++++++++++++++----------- build/codex-editor.js.map | 2 +- src/components/dom.js | 9 ---- src/components/modules/blockManager.js | 47 ++++++++++++++----- src/components/modules/caret.js | 15 ++---- 5 files changed, 77 insertions(+), 60 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index d4caa3e23..d8d82d8d5 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -558,7 +558,6 @@ var Dom = function () { var child = atLast ? 'lastChild' : 'firstChild', sibling = atLast ? 'previousSibling' : 'nextSibling'; - console.log('node is ', node); if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { var nodeChild = node[child]; @@ -592,13 +591,6 @@ var Dom = function () { return this.getDeepestNode(nodeChild, atLast); } - if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') { - - var zeroSpaceSymbol = document.createTextNode('\u200B'); - - node.parentNode.appendChild(zeroSpaceSymbol); - } - return node; } @@ -1515,23 +1507,35 @@ var BlockManager = function (_Module) { key: 'navigateNext', value: function navigateNext() { - var lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), - textNodeLength = void 0; + var lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true); - if (lastNode.nodeType === Node.ELEMENT_NODE) { + /** + * Founded contentEditable element doesn't have childs + * Or maybe New created block + */ + var currentBlockIsEmpty = this.currentBlock.isEmpty; - textNodeLength = lastNode.textContent.length; - } else { + /** + * Case of + *

    + * adaddad| + *

    <---- deepest (lastNode) node is , but caret is in 'adaddad' + *
    + */ + if (!currentBlockIsEmpty && $.isEmpty(lastNode)) { - textNodeLength = lastNode.length; + lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false); } - if (_Selection2.default.getAnchorNode() !== lastNode) { + var caretInTheLastNode = _Selection2.default.getAnchorNode() === lastNode, + caretAtTheEndOfLastNode = _Selection2.default.getAnchorOffset() === lastNode.textContent.length; + + if (!currentBlockIsEmpty && !caretInTheLastNode) { return; } - if (_Selection2.default.getAnchorOffset() === textNodeLength) { + if (caretAtTheEndOfLastNode) { var nextBlock = this.nextBlock; @@ -1543,7 +1547,7 @@ var BlockManager = function (_Module) { /** * Set's caret to the previous Block - * Before moving caret, we should check if caret position is at the end of Plugins node + * Before moving caret, we should check if caret position is start of the Plugins node * Using {@link Dom#getDeepestNode} to get a last node and match with current selection */ @@ -1554,7 +1558,15 @@ var BlockManager = function (_Module) { var firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false), textNodeLength = firstTextNode.length; - if (_Selection2.default.getAnchorNode() !== firstTextNode) { + var caretInTheFirstNode = _Selection2.default.getAnchorNode() === firstTextNode; + + /** + * Founded contentEditable element doesn't have childs + * Or maybe New created block + */ + var currentBlockIsEmpty = this.currentBlock.isEmpty; + + if (!currentBlockIsEmpty && !caretInTheFirstNode) { return; } @@ -1563,7 +1575,10 @@ var BlockManager = function (_Module) { var previousBlock = this.previousBlock; - if (!previousBlock) return; + if (!previousBlock) { + + return; + } this.Editor.Caret.setToBlock(previousBlock, textNodeLength, true); } @@ -2497,19 +2512,12 @@ var Caret = function (_Module) { offset = nodeToSet.length; } - - /** if found deepest node is native input */ - if ($.isNativeInput(nodeToSet)) { - - nodeToSet.focus(); - return; - } - /** * @todo try to fix via Promises or use querySelectorAll to not to use timeout */ _.delay(function () { - return _this2.set(nodeToSet, offset); + + _this2.set(nodeToSet, offset); }, 20)(); this.Editor.BlockManager.currentNode = block.wrapper; diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index c5c40a8ee..a33d75199 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 035b5e641e17429bdafb","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","log","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","TEXT_NODE","textContent","trim","zeroSpaceSymbol","nativeInputs","nodeText","isElement","isNativeInput","value","replace","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","textNodeLength","getAnchorNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SA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BACIuN,YAAY,CADhB;;AAGA/V,oBAAQgW,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBzR,OAAjB,CAAyB,UAAC8R,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACArM,wBAAQ4E,GAAR,UAAgBqR,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA1G,sBAAMvC,IAAN,CAAWgQ,WAAW/U,IAAtB;AAEH,aAPD;;AASAlB,oBAAQ4E,GAAR,CAAY,OAAZ,EAAqBmR,SAArB;AACA/V,oBAAQkW,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH3N,uBAAUA,KAFP;AAGH4N,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BhX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKlb,MAAL,CAAYyI,KAAZ,CAAkB0S,SAAlB,CAA4B,KAAKnb,MAAL,CAAY2I,YAAZ,CAAyB+C,YAAzB,CAAsC+C,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKpb,MAAL,CAAY2I,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAIwR,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKpb,MAAL,CAAY+S,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2B9a,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 035b5e641e17429bdafb","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n console.log('node is ', node);\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') {\n\n let zeroSpaceSymbol = document.createTextNode('\\u200b');\n\n node.parentNode.appendChild(zeroSpaceSymbol);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true),\n textNodeLength;\n\n if (lastNode.nodeType === Node.ELEMENT_NODE) {\n\n textNodeLength = lastNode.textContent.length;\n\n } else {\n\n textNodeLength = lastNode.length;\n\n }\n\n if (Selection.getAnchorNode() !== lastNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === textNodeLength) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n if (Selection.getAnchorNode() !== firstTextNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) return;\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => this.set(nodeToSet, offset), 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 295e0291cf5f558db3d8","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATpW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqW,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAI9L,SAAS,KAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBqW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATlX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACT2C,qBAAS,IADA;AAET8J,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK3M,KAAL,CAAW2C,OAAX,GAAqB1B,EAAE2B,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAK3C,KAAL,CAAWyM,YAAX,GAA0BxL,EAAE2B,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBuJ,YAAhC,CAA1B;AACA,iBAAKzM,KAAL,CAAW0M,eAAX,GAA6BzL,EAAE2B,IAAF,CAAO,KAAP,EAAc4J,cAActJ,GAAd,CAAkBwJ,eAAhC,CAA7B;;AAEAzL,cAAE4B,M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AEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKnb,MAAL,CAAYiT,OAAZ,CAAoBsF,IAApB;AACA,WAAKvY,MAAL,CAAYiT,OAAZ,CAAoBwF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKzY,MAAL,CAAYiT,OAAZ,CAAoB0F,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKpb,MAAL,CAAYuI,KAAZ,CAAkB8S,SAAlB,CAA4B,KAAKrb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsCmD,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKtb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAI4R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKtb,MAAL,CAAYiT,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bhb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,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;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 295e0291cf5f558db3d8","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *

    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index fe525a61b..bc390dae7 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -124,7 +124,6 @@ export default class Dom { let child = atLast ? 'lastChild' : 'firstChild', sibling = atLast ? 'previousSibling' : 'nextSibling'; - console.log('node is ', node); if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) { let nodeChild = node[child]; @@ -163,14 +162,6 @@ export default class Dom { } - if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '') { - - let zeroSpaceSymbol = document.createTextNode('\u200b'); - - node.parentNode.appendChild(zeroSpaceSymbol); - - } - return node; } diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index a95704749..8a591d70d 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -121,26 +121,37 @@ export default class BlockManager extends Module { */ navigateNext() { - let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true), - textNodeLength; + let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true); - if (lastNode.nodeType === Node.ELEMENT_NODE) { - - textNodeLength = lastNode.textContent.length; + /** + * Founded contentEditable element doesn't have childs + * Or maybe New created block + */ + let currentBlockIsEmpty = this.currentBlock.isEmpty; - } else { + /** + * Case of + *

    + * adaddad| + *

    <---- deepest (lastNode) node is , but caret is in 'adaddad' + *
    + */ + if (!currentBlockIsEmpty && $.isEmpty(lastNode)) { - textNodeLength = lastNode.length; + lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false); } - if (Selection.getAnchorNode() !== lastNode) { + let caretInTheLastNode = Selection.getAnchorNode() === lastNode, + caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length; + + if (!currentBlockIsEmpty && !caretInTheLastNode) { return; } - if (Selection.getAnchorOffset() === textNodeLength) { + if (caretAtTheEndOfLastNode) { let nextBlock = this.nextBlock; @@ -154,7 +165,7 @@ export default class BlockManager extends Module { /** * Set's caret to the previous Block - * Before moving caret, we should check if caret position is at the end of Plugins node + * Before moving caret, we should check if caret position is start of the Plugins node * Using {@link Dom#getDeepestNode} to get a last node and match with current selection */ navigatePrevious() { @@ -162,7 +173,15 @@ export default class BlockManager extends Module { let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false), textNodeLength = firstTextNode.length; - if (Selection.getAnchorNode() !== firstTextNode) { + let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode; + + /** + * Founded contentEditable element doesn't have childs + * Or maybe New created block + */ + let currentBlockIsEmpty = this.currentBlock.isEmpty; + + if (!currentBlockIsEmpty && !caretInTheFirstNode) { return; @@ -172,7 +191,11 @@ export default class BlockManager extends Module { let previousBlock = this.previousBlock; - if (!previousBlock) return; + if (!previousBlock) { + + return; + + } this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true ); diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index e3623154e..bfde0e4dc 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -54,19 +54,14 @@ export default class Caret extends Module { offset = nodeToSet.length; } - - /** if found deepest node is native input */ - if ($.isNativeInput(nodeToSet)) { - - nodeToSet.focus(); - return; - - } - /** * @todo try to fix via Promises or use querySelectorAll to not to use timeout */ - _.delay( () => this.set(nodeToSet, offset), 20)(); + _.delay( () => { + + this.set(nodeToSet, offset); + + }, 20)(); this.Editor.BlockManager.currentNode = block.wrapper; From 12e1d37089feea866bd4f6233adfc5ab778bd58d Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Fri, 25 May 2018 21:09:22 +0300 Subject: [PATCH 18/33] improve isAtStart --- build/codex-editor.js | 59 +++++++++++++++++++++++++++++- build/codex-editor.js.map | 2 +- src/components/dom.js | 9 +++++ src/components/modules/caret.js | 47 ++++++++++++++++++++++++ src/components/modules/keyboard.js | 4 +- 5 files changed, 118 insertions(+), 3 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index d8d82d8d5..e0c436991 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -709,6 +709,14 @@ var Dom = function () { treeWalker.push(node); } + /** + * If one of childs is not empty, checked Node is not empty too + */ + if (node && !this.isNodeEmpty(node)) { + + return false; + } + node = treeWalker.shift(); if (!node) continue; @@ -2599,6 +2607,33 @@ var Caret = function (_Module) { } } + /** + * Get all first-level (first child of [contenteditabel]) siblings from passed node + */ + + }, { + key: 'getHigherLevelSiblings', + value: function getHigherLevelSiblings(from, direction) { + + var current = from; + + while (current.parentNode.contentEditable !== 'true') { + + current = current.parentNode; + } + + var siblings = [], + sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + + while (current[sibling]) { + + current = current[sibling]; + siblings.push(current); + } + + return siblings; + } + /** * Get's deepest first node and checks if offset is zero * @return {boolean} @@ -2612,6 +2647,26 @@ var Caret = function (_Module) { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + /** + * In case of + *
    + *

    + * |adaddad + *
    + */ + if ($.isEmpty(firstNode)) { + + var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), + nothingAtLeft = leftSiblings.every(function (node) { + return node.textContent.length === 0; + }); + + if (nothingAtLeft && selection.anchorOffset === 0) { + + return true; + } + } + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; } @@ -2904,6 +2959,8 @@ var Keyboard = function (_Module) { this.Editor.BlockManager.navigatePrevious(); } + var caretAtTheEnd = targetBlock.isEmpty ? false : true; + this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge).then(function () { // decrease current block index so that to know current actual @@ -2912,7 +2969,7 @@ var Keyboard = function (_Module) { window.setTimeout(function () { // set caret to the block without offset at the end - _this2.Editor.Caret.setToBlock(_this2.Editor.BlockManager.currentBlock, 0, true); + _this2.Editor.Caret.setToBlock(_this2.Editor.BlockManager.currentBlock, 0, caretAtTheEnd); _this2.Editor.Toolbar.close(); }, 10); }); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index a33d75199..290395622 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 295e0291cf5f558db3d8","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","shift","firstChild","every","isNodeEmpty","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","firstNode","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","current","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SA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A,4BAyHwB;;AAEhB,mBAAO,KAAKjJ,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,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OAAjB,CAAyB,UAACgS,UAAD,EAAa5J,KAAb,EAAuB;;AAE5C;AACAvM,wBAAQqH,GAAR,UAAgB8O,WAAW9H,IAA3B,uBAAgD8H,UAAhD;AACAF,6BAAaE,WAAW/G,IAAxB;AACA9G,sBAAMxC,IAAN,CAAWqQ,WAAWjV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqB4O,SAArB;AACAjW,oBAAQoW,QAAR;;AAEA,mBAAO;AACHhH,sBAAU,CAAC,IAAIiH,IAAJ,EADR;AAEH/N,uBAAUA,KAFP;AAGHgO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BlX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqBqW,K;;;;;;;;;;;;;;;;;;;;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uI,KAAZ,CAAkB8S,SAAlB,CAA4B,KAAKrb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsCmD,IAAlE,CAArB;AAAA,UACI2M,eAAe,KAAKtb,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAI4R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKtb,MAAL,CAAYiT,OAAZ,CAAoB0F,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bhb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 295e0291cf5f558db3d8","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *
    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 7a4f381bd9f4a632e89c","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,OAAP,CAAgBH,IAAhB,CAA5B,EAAqD;;AAEjD,wBAAKC,IAAL,EAAYC,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AuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT3W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK4W,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAIrM,SAAS,KAAKpK,MAAL,CAAYyI,YAAZ,CAAyB2B,MAAtC;AAAA,gBACIhJ,YAAY,EADhB;;AAGAgJ,mBAAO3F,OAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK1b,MAAL,CAAYyT,OAAZ,CAAoBqF,IAApB;AACA,WAAK9Y,MAAL,CAAYyT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKhZ,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAK3b,MAAL,CAAYuI,KAAZ,CAAkBqT,SAAlB,CAA4B,KAAK5b,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsCmD,IAAlE,CAArB;AAAA,UACIkN,eAAe,KAAK7b,MAAL,CAAYyI,YAAZ,CAAyB+C,YAAzB,CAAsChC,OADzD;;AAGA,UAAImS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bvb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7a4f381bd9f4a632e89c","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *

    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from;\n\n while (current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let siblings = [],\n sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    \n * |adaddad\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index bc390dae7..b6c36c28e 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -278,6 +278,15 @@ export default class Dom { } + /** + * If one of childs is not empty, checked Node is not empty too + */ + if (node && !this.isNodeEmpty(node)) { + + return false; + + } + node = treeWalker.shift(); if (!node) continue; diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index bfde0e4dc..e7f66bb2d 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -139,6 +139,33 @@ export default class Caret extends Module { } + /** + * Get all first-level (first child of [contenteditabel]) siblings from passed node + */ + getHigherLevelSiblings(from, direction ) { + + let current = from; + + while (current.parentNode.contentEditable !== 'true') { + + current = current.parentNode; + + } + + let siblings = [], + sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + + while (current[sibling]) { + + current = current[sibling]; + siblings.push(current); + + } + + return siblings; + + } + /** * Get's deepest first node and checks if offset is zero * @return {boolean} @@ -149,6 +176,26 @@ export default class Caret extends Module { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + /** + * In case of + *

    + *

    + * |adaddad + *
    + */ + if ($.isEmpty(firstNode)) { + + let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), + nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 ); + + if (nothingAtLeft && selection.anchorOffset === 0) { + + return true; + + } + + } + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; } diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index ed9449d6e..328b49e74 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -131,6 +131,8 @@ export default class Keyboard extends Module { } + let caretAtTheEnd = targetBlock.isEmpty ? false : true; + this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge) .then( () => { @@ -140,7 +142,7 @@ export default class Keyboard extends Module { window.setTimeout( () => { // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, true); + this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd); this.Editor.Toolbar.close(); }, 10); From d5b0ebe7177cf1a520d81b863d7a330c5e42aec7 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Fri, 25 May 2018 21:10:11 +0300 Subject: [PATCH 19/33] improve docs --- build/codex-editor.js | 2 +- build/codex-editor.js.map | 2 +- src/components/modules/caret.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index e0c436991..8f8811cf1 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -2650,7 +2650,7 @@ var Caret = function (_Module) { /** * In case of *
    - *

    + *

    <--- first (and deepest) node is * |adaddad *
    */ diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 290395622..dad77eb1d 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 7a4f381bd9f4a632e89c","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAA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AEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAKjJ,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAM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AEH,qBAAKZ,aAAL,GAAqB7V,MAArB;AAEH;AAEJ;;;8BAkCYmW,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCpW,M;;;kBAAlB6V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA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AIwH,IAAJ,EADR;AAEHtO,uBAAUA,KAFP;AAGHuO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BzX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB4W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATzX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACT2C,qBAAS,IADA;AAETqK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKlN,KAAL,CAAW2C,O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;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bvb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAA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ACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7a4f381bd9f4a632e89c","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *
    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from;\n\n while (current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let siblings = [],\n sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    \n * |adaddad\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 7723d72b877c115523ae","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,K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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AlB,CAAP;AAEH;;;;EA3GkCpW,M;;;kBAAlB6V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT3W,MAAS,QAATA,MAAS;;AAAA;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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB4W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATzX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACT2C,qBAAS,IADA;AAETqK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKlN,KAAL,CAAW2C,OAAX,GAAqB1B,EAAE2B,IAAF,CAAO,KAAP,EAAcmK,cAAc7J,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAK3C,KAAL,CAAWgN,YAAX,GAA0B/L,EAAE2B,IAAF,CAAO,KAAP,EAAcmK,c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AEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,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ACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7723d72b877c115523ae","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *

    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from;\n\n while (current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let siblings = [],\n sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <--- first (and deepest) node is \n * |adaddad\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index e7f66bb2d..be2714c45 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -179,7 +179,7 @@ export default class Caret extends Module { /** * In case of *

    - *

    + *

    <--- first (and deepest) node is * |adaddad *
    */ From e1028fad1769d62c9bd6279be1e18468ec1668d8 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 16:12:41 +0300 Subject: [PATCH 20/33] use smart isAtStart and isAtEnt method in navigateNext/navigatePrevious --- build/codex-editor.js | 91 +++++++++++--------------- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 60 ++++------------- src/components/modules/caret.js | 36 +++++++--- 4 files changed, 81 insertions(+), 108 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 8f8811cf1..85040b6ce 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1515,42 +1515,21 @@ var BlockManager = function (_Module) { key: 'navigateNext', value: function navigateNext() { - var lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true); + var caretAtEnd = this.Editor.Caret.isAtEnd; - /** - * Founded contentEditable element doesn't have childs - * Or maybe New created block - */ - var currentBlockIsEmpty = this.currentBlock.isEmpty; + if (!caretAtEnd) { - /** - * Case of - *
    - * adaddad| - *

    <---- deepest (lastNode) node is , but caret is in 'adaddad' - *
    - */ - if (!currentBlockIsEmpty && $.isEmpty(lastNode)) { - - lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false); + return; } - var caretInTheLastNode = _Selection2.default.getAnchorNode() === lastNode, - caretAtTheEndOfLastNode = _Selection2.default.getAnchorOffset() === lastNode.textContent.length; + var nextBlock = this.nextBlock; - if (!currentBlockIsEmpty && !caretInTheLastNode) { + if (!nextBlock) { return; } - if (caretAtTheEndOfLastNode) { - - var nextBlock = this.nextBlock; - - if (!nextBlock) return; - - this.Editor.Caret.setToBlock(nextBlock); - } + this.Editor.Caret.setToBlock(nextBlock); } /** @@ -1563,33 +1542,21 @@ var BlockManager = function (_Module) { key: 'navigatePrevious', value: function navigatePrevious() { - var firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false), - textNodeLength = firstTextNode.length; - - var caretInTheFirstNode = _Selection2.default.getAnchorNode() === firstTextNode; - - /** - * Founded contentEditable element doesn't have childs - * Or maybe New created block - */ - var currentBlockIsEmpty = this.currentBlock.isEmpty; + var caretAtStart = this.Editor.Caret.isAtStart; - if (!currentBlockIsEmpty && !caretInTheFirstNode) { + if (!caretAtStart) { return; } - if (_Selection2.default.getAnchorOffset() === 0) { - - var previousBlock = this.previousBlock; + var previousBlock = this.previousBlock; - if (!previousBlock) { - - return; - } + if (!previousBlock) { - this.Editor.Caret.setToBlock(previousBlock, textNodeLength, true); + return; } + + this.Editor.Caret.setToBlock(previousBlock, 0, true); } /** @@ -2615,15 +2582,15 @@ var Caret = function (_Module) { key: 'getHigherLevelSiblings', value: function getHigherLevelSiblings(from, direction) { - var current = from; + var current = from, + siblings = []; - while (current.parentNode.contentEditable !== 'true') { + while (current.parentNode && current.parentNode.contentEditable !== 'true') { current = current.parentNode; } - var siblings = [], - sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + var sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; while (current[sibling]) { @@ -2650,8 +2617,8 @@ var Caret = function (_Module) { /** * In case of *
    - *

    <--- first (and deepest) node is - * |adaddad + *

    <-- first (and deepest) node is + * |adaddad <-- anchor node *
    */ if ($.isEmpty(firstNode)) { @@ -2683,6 +2650,26 @@ var Caret = function (_Module) { anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); + /** + * In case of + *
    + * adaddad| <-- anchor node + *

    <-- first (and deepest) node is + *
    + */ + if ($.isEmpty(lastNode)) { + + var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'), + nothingAtRight = leftSiblings.every(function (node) { + return node.textContent.length === 0; + }); + + if (nothingAtRight && selection.anchorOffset === 0) { + + return true; + } + } + return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; } }]); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index dad77eb1d..3bb58aed9 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 7723d72b877c115523ae","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","lastNode","$","currentBlock","currentBlockIsEmpty","caretInTheLastNode","getAnchorNode","caretAtTheEndOfLastNode","getAnchorOffset","nextBlock","Caret","setToBlock","firstTextNode","textNodeLength","caretInTheFirstNode","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","isAtStart","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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lB,CAAP;AAEH;;;;EA3GkCpW,M;;;kBAAlB6V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT3W,MAAS,QAATA,MAAS;;AAAA;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB4W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATzX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACT2C,qBAAS,IADA;AAETqK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKlN,KAAL,CAAW2C,OAAX,GAAqB1B,EAAE2B,IAAF,CAAO,KAAP,EAAcmK,cAAc7J,GAAd,CAAkBP,OAAhC,CAArB;;AAEA,iBAAK3C,KAAL,CAAWgN,YAAX,GAA0B/L,EAAE2B,IAAF,CAAO,KAAP,EAAcmK,cA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EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,w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A;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7723d72b877c115523ae","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true);\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n /**\n * Case of\n *
    \n * adaddad|\n *

    <---- deepest (lastNode) node is , but caret is in 'adaddad'\n *
    \n */\n if (!currentBlockIsEmpty && $.isEmpty(lastNode)) {\n\n lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false);\n\n }\n\n let caretInTheLastNode = Selection.getAnchorNode() === lastNode,\n caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length;\n\n if (!currentBlockIsEmpty && !caretInTheLastNode) {\n\n return;\n\n }\n\n if (caretAtTheEndOfLastNode) {\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) return;\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n }\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false),\n textNodeLength = firstTextNode.length;\n\n let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode;\n\n /**\n * Founded contentEditable element doesn't have childs\n * Or maybe New created block\n */\n let currentBlockIsEmpty = this.currentBlock.isEmpty;\n\n if (!currentBlockIsEmpty && !caretInTheFirstNode) {\n\n return;\n\n }\n\n if (Selection.getAnchorOffset() === 0) {\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true );\n\n }\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from;\n\n while (current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let siblings = [],\n sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <--- first (and deepest) node is \n * |adaddad\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap be83e367f7d814a69dad","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,OAAP,CAAgBH,IAAhB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CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAI3N,QAAQ,EAAZ;AAAA,gBACI8N,YAAY,CADhB;;AAGApW,oBAAQqW,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiB9R,OAAjB,CAAyB,UAACmS,UAAD,EAAatK,KAAb,EAAuB;;AAE5C;AACAhM,wBAAQqH,GAAR,UAAgBiP,WAAWtI,IAA3B,uBAAgDsI,UAAhD;AACAF,6BAAaE,WAAWvH,IAAxB;AACAzG,sBAAMxC,IAAN,CAAWwQ,WAAWpV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqB+O,SAArB;AACApW,oBAAQuW,QAAR;;AAEA,mBAAO;AACHxH,sBAAU,CAAC,IAAIyH,IAAJ,EADR;AAEHlO,uBAAUA,KAFP;AAGHmO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BrX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AACA;;AAEA;;;AAGA,WAAK5Y,MAAL,CAAYqT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKvb,MAAL,CAAYuI,KAAZ,CAAkBiT,SAAlB,CAA4B,KAAKxb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACImN,eAAe,KAAKzb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAI+R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKzb,MAAL,CAAYqT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bnb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap be83e367f7d814a69dad","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n \n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *

    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 8a591d70d..ddfef30c5 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -121,45 +121,24 @@ export default class BlockManager extends Module { */ navigateNext() { - let lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, true); + let caretAtEnd = this.Editor.Caret.isAtEnd; - /** - * Founded contentEditable element doesn't have childs - * Or maybe New created block - */ - let currentBlockIsEmpty = this.currentBlock.isEmpty; + if (!caretAtEnd) { - /** - * Case of - *

    - * adaddad| - *

    <---- deepest (lastNode) node is , but caret is in 'adaddad' - *
    - */ - if (!currentBlockIsEmpty && $.isEmpty(lastNode)) { - - lastNode = $.getDeepestNode(this.currentBlock.pluginsContent, false); + return; } - let caretInTheLastNode = Selection.getAnchorNode() === lastNode, - caretAtTheEndOfLastNode = Selection.getAnchorOffset() === lastNode.textContent.length; + let nextBlock = this.nextBlock; - if (!currentBlockIsEmpty && !caretInTheLastNode) { + if (!nextBlock) { return; } - if (caretAtTheEndOfLastNode) { + this.Editor.Caret.setToBlock( nextBlock ); - let nextBlock = this.nextBlock; - - if (!nextBlock) return; - - this.Editor.Caret.setToBlock( nextBlock ); - - } } @@ -170,37 +149,24 @@ export default class BlockManager extends Module { */ navigatePrevious() { - let firstTextNode = $.getDeepestNode(this.currentBlock.pluginsContent, false), - textNodeLength = firstTextNode.length; + let caretAtStart = this.Editor.Caret.isAtStart; - let caretInTheFirstNode = Selection.getAnchorNode() === firstTextNode; - - /** - * Founded contentEditable element doesn't have childs - * Or maybe New created block - */ - let currentBlockIsEmpty = this.currentBlock.isEmpty; - - if (!currentBlockIsEmpty && !caretInTheFirstNode) { + if (!caretAtStart) { return; } - if (Selection.getAnchorOffset() === 0) { - - let previousBlock = this.previousBlock; - - if (!previousBlock) { + let previousBlock = this.previousBlock; - return; + if (!previousBlock) { - } - - this.Editor.Caret.setToBlock( previousBlock, textNodeLength, true ); + return; } + this.Editor.Caret.setToBlock( previousBlock, 0, true ); + } /** diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index be2714c45..392ac634b 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -140,20 +140,20 @@ export default class Caret extends Module { } /** - * Get all first-level (first child of [contenteditabel]) siblings from passed node - */ + * Get all first-level (first child of [contenteditabel]) siblings from passed node + */ getHigherLevelSiblings(from, direction ) { - let current = from; + let current = from, + siblings = []; - while (current.parentNode.contentEditable !== 'true') { + while (current.parentNode && current.parentNode.contentEditable !== 'true') { current = current.parentNode; } - let siblings = [], - sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; while (current[sibling]) { @@ -179,8 +179,8 @@ export default class Caret extends Module { /** * In case of *
    - *

    <--- first (and deepest) node is - * |adaddad + *

    <-- first (and deepest) node is + * |adaddad <-- anchor node *
    */ if ($.isEmpty(firstNode)) { @@ -210,6 +210,26 @@ export default class Caret extends Module { anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); + /** + * In case of + *
    + * adaddad| <-- anchor node + *

    <-- first (and deepest) node is + *
    + */ + if ($.isEmpty(lastNode)) { + + let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'), + nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 ); + + if (nothingAtRight && selection.anchorOffset === 0) { + + return true; + + } + + } + return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length; } From 4636c7aaca1af0983f2025f171497a5f418f6089 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 16:20:06 +0300 Subject: [PATCH 21/33] improve docs --- src/components/modules/caret.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 392ac634b..0a99b8e1c 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -140,13 +140,30 @@ export default class Caret extends Module { } /** - * Get all first-level (first child of [contenteditabel]) siblings from passed node - */ + * Get all first-level (first child of [contenteditabel]) siblings from passed node + * Then you can check it for emptiness + * + * @example + * + * + * @return {Element[]} + */ getHigherLevelSiblings(from, direction ) { let current = from, siblings = []; + /** + * Find passed node's firs-level parent (in example - blockquote) + */ while (current.parentNode && current.parentNode.contentEditable !== 'true') { current = current.parentNode; @@ -155,6 +172,9 @@ export default class Caret extends Module { let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + /** + * Find all left/right siblings + */ while (current[sibling]) { current = current[sibling]; From e85725f12e5fcd35e557ccc39e47455b7726d9ce Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 17:26:17 +0300 Subject: [PATCH 22/33] fix bug in $.isEmpty, improve keydown --- build/codex-editor.js | 60 +++++++++++++++++++++++------- build/codex-editor.js.map | 2 +- docs/tools.md | 10 ++++- src/components/dom.js | 10 ++++- src/components/modules/keyboard.js | 30 +++++++++------ 5 files changed, 84 insertions(+), 28 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 85040b6ce..e539fadbe 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -688,7 +688,12 @@ var Dom = function () { if (!node) { - return false; + return true; + } + + if (!node.childNodes.length) { + + return this.isNodeEmpty(node); } treeWalker.push(node); @@ -2575,8 +2580,22 @@ var Caret = function (_Module) { } /** - * Get all first-level (first child of [contenteditabel]) siblings from passed node - */ + * Get all first-level (first child of [contenteditabel]) siblings from passed node + * Then you can check it for emptiness + * + * @example + * + * + * @return {Element[]} + */ }, { key: 'getHigherLevelSiblings', @@ -2585,6 +2604,9 @@ var Caret = function (_Module) { var current = from, siblings = []; + /** + * Find passed node's firs-level parent (in example - blockquote) + */ while (current.parentNode && current.parentNode.contentEditable !== 'true') { current = current.parentNode; @@ -2592,6 +2614,9 @@ var Caret = function (_Module) { var sibling = direction === 'left' ? 'previousSibling' : 'nextSibling'; + /** + * Find all left/right siblings + */ while (current[sibling]) { current = current[sibling]; @@ -2919,7 +2944,7 @@ var Keyboard = function (_Module) { /** * Handle backspace keypress on block - * @param event + * @param {KeyboardEvent} event - keydown */ }, { @@ -2927,8 +2952,10 @@ var Keyboard = function (_Module) { value: function backspacePressed(event) { var _this2 = this; - var isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock; + var BM = this.Editor.BlockManager; + + var isFirstBlock = BM.currentBlockIndex === 0, + canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock; if (!canMergeBlocks) { @@ -2938,25 +2965,32 @@ var Keyboard = function (_Module) { // preventing browser default behaviour event.preventDefault(); - var targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), - blockToMerge = this.Editor.BlockManager.currentBlock; + var targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1), + blockToMerge = BM.currentBlock; + /** + * Blocks that can be merged: + * 1) with the same Name + * 2) Tool has 'merge' method + * + * other case will handle as usual ARROW LEFT behaviour + */ if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) { - this.Editor.BlockManager.navigatePrevious(); + BM.navigatePrevious(); } - var caretAtTheEnd = targetBlock.isEmpty ? false : true; + var setCaretToTheEnd = !targetBlock.isEmpty ? true : false; - this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge).then(function () { + BM.mergeBlocks(targetBlock, blockToMerge).then(function () { // decrease current block index so that to know current actual - _this2.Editor.BlockManager.currentBlockIndex--; + BM.currentBlockIndex--; window.setTimeout(function () { // set caret to the block without offset at the end - _this2.Editor.Caret.setToBlock(_this2.Editor.BlockManager.currentBlock, 0, caretAtTheEnd); + _this2.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd); _this2.Editor.Toolbar.close(); }, 10); }); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 3bb58aed9..2d1dacfa6 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap be83e367f7d814a69dad","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","push","isLeaf","nextSibling","isNodeEmpty","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","caretAtTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAG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;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATvW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKwW,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAIjM,SAAS,KAAKpK,MAAL,CAAYyI,YAAZ,CAAyB2B,MAAtC;AAAA,gBACIhJ,YAAY,EADhB;;AAGAgJ,mBAA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKtb,MAAL,CAAYqT,OAAZ,CAAoBqF,IAApB;AACA,WAAK1Y,MAAL,CAAYqT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK5Y,MAAL,CAAYqT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKvb,MAAL,CAAYuI,KAAZ,CAAkBiT,SAAlB,CAA4B,KAAKxb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACImN,eAAe,KAAKzb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAI+R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAKzb,MAAL,CAAYqT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bnb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap be83e367f7d814a69dad","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return false;\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf)) ;\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n \n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param event\n */\n backspacePressed(event) {\n\n let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0,\n canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1),\n blockToMerge = this.Editor.BlockManager.currentBlock;\n\n\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n let caretAtTheEnd = targetBlock.isEmpty ? false : true;\n\n this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n this.Editor.BlockManager.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap ac6f73edd0b0c39cce11","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,E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AAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKyW,MAAL,GAAc,IAAd;AACA,cAAKC,UA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqByW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATtX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACToC,qBAAS,IADA;AAETyK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK/M,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW6M,YAAX,GAA0BxK,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkBiK,YAAhC,CAA1B;AACA,iBAAK7M,KAAL,CAAW8M,eAAX,GAA6BzK,EAAEC,IAAF,CA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AAlB;AAEH;;AAGD;;;AAGA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKvb,MAAL,CAAYsT,OAAZ,CAAoBqF,IAApB;AACA,WAAK3Y,MAAL,CAAYsT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK7Y,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKxb,MAAL,CAAYuI,KAAZ,CAAkBkT,SAAlB,CAA4B,KAAKzb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIoN,eAAe,KAAK1b,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIgS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK1b,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bpb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4B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ACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ac6f73edd0b0c39cce11","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/tools.md b/docs/tools.md index b6be8d92a..9b5dbdda3 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -8,9 +8,17 @@ CodeX Editor is a block-oriented editor. It means that entry composed with the l ### Constructor +### Render + ### Save -### Render +### Validate + +### Merge (optional) + +Method that specifies how to merge two `Blocks` of the same type, for example on `Backspace` keypress. +Method does accept data object in same format as the `Render` and it should provide logic how to combine new +data with the currently stored value. ### Available settings diff --git a/src/components/dom.js b/src/components/dom.js index b6c36c28e..ccec73bde 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -254,7 +254,13 @@ export default class Dom { if (!node) { - return false; + return true; + + } + + if (!node.childNodes.length) { + + return this.isNodeEmpty(node); } @@ -296,7 +302,7 @@ export default class Dom { } - return leafs.every( leaf => this.isNodeEmpty(leaf)) ; + return leafs.every( leaf => this.isNodeEmpty(leaf) ); } diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index 328b49e74..d20aa1175 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -105,12 +105,14 @@ export default class Keyboard extends Module { /** * Handle backspace keypress on block - * @param event + * @param {KeyboardEvent} event - keydown */ backspacePressed(event) { - let isFirstBlock = this.Editor.BlockManager.currentBlockIndex === 0, - canMergeBlocks = (this.Editor.BlockManager.currentBlock.isEmpty || this.Editor.Caret.isAtStart) && !isFirstBlock; + const BM = this.Editor.BlockManager; + + let isFirstBlock = BM.currentBlockIndex === 0, + canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock; if (!canMergeBlocks) { @@ -121,28 +123,34 @@ export default class Keyboard extends Module { // preventing browser default behaviour event.preventDefault(); - let targetBlock = this.Editor.BlockManager.getBlockByIndex(this.Editor.BlockManager.currentBlockIndex - 1), - blockToMerge = this.Editor.BlockManager.currentBlock; - + let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1), + blockToMerge = BM.currentBlock; + /** + * Blocks that can be merged: + * 1) with the same Name + * 2) Tool has 'merge' method + * + * other case will handle as usual ARROW LEFT behaviour + */ if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) { - this.Editor.BlockManager.navigatePrevious(); + BM.navigatePrevious(); } - let caretAtTheEnd = targetBlock.isEmpty ? false : true; + let setCaretToTheEnd = !targetBlock.isEmpty ? true : false; - this.Editor.BlockManager.mergeBlocks(targetBlock, blockToMerge) + BM.mergeBlocks(targetBlock, blockToMerge) .then( () => { // decrease current block index so that to know current actual - this.Editor.BlockManager.currentBlockIndex--; + BM.currentBlockIndex--; window.setTimeout( () => { // set caret to the block without offset at the end - this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock, 0, caretAtTheEnd); + this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd); this.Editor.Toolbar.close(); }, 10); From 768348fb85e7c1bbeef535b8305cb11e7b066b56 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 17:34:05 +0300 Subject: [PATCH 23/33] fix isAtEnd --- build/codex-editor.js | 2 +- build/codex-editor.js.map | 2 +- src/components/modules/caret.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index e539fadbe..c8b0c719d 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -2689,7 +2689,7 @@ var Caret = function (_Module) { return node.textContent.length === 0; }); - if (nothingAtRight && selection.anchorOffset === 0) { + if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) { return true; } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 2d1dacfa6..1ed243d63 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap ac6f73edd0b0c39cce11","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqB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,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCjW,M;;;kBAAlB0V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqByW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATtX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACToC,qBAAS,IADA;AAETyK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK/M,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW6M,YAAX,GA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AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8B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AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ac6f73edd0b0c39cce11","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap f637ef3bf2395ab6380c","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;A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R,UAAgBkP,WAAWvI,IAA3B,uBAAgDuI,UAAhD;AACAF,6BAAaE,WAAWxH,IAAxB;AACAzG,sBAAMvC,IAAN,CAAWwQ,WAAWrV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBgP,SAArB;AACArW,oBAAQwW,QAAR;;AAEA,mBAAO;AACHzH,sBAAU,CAAC,IAAI0H,IAAJ,EADR;AAEHnO,uBAAUA,KAFP;AAGHoO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BtX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqByW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATtX,MAAS,QAATA,MA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,UACIoN,eAAe,KAAK1b,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIgS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK1b,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bpb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f637ef3bf2395ab6380c","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 0a99b8e1c..72d096f46 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -242,7 +242,7 @@ export default class Caret extends Module { let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'), nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 ); - if (nothingAtRight && selection.anchorOffset === 0) { + if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) { return true; From fc442971c94c80562adbb09e8ff607a3a0d0a410 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 17:36:56 +0300 Subject: [PATCH 24/33] rollback setCaret code duplication --- build/codex-editor.js | 8 ++++++++ build/codex-editor.js.map | 2 +- src/components/modules/caret.js | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index c8b0c719d..9476805f8 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -2492,6 +2492,14 @@ var Caret = function (_Module) { offset = nodeToSet.length; } + + /** if found deepest node is native input */ + if ($.isNativeInput(nodeToSet)) { + + nodeToSet.focus(); + return; + } + /** * @todo try to fix via Promises or use querySelectorAll to not to use timeout */ diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 1ed243d63..5c6a8ad08 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap f637ef3bf2395ab6380c","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AAC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AAQqH,GAAR,UAAgBkP,WAAWvI,IAA3B,uBAAgDuI,UAAhD;AACAF,6BAAaE,WAAWxH,IAAxB;AACAzG,sBAAMvC,IAAN,CAAWwQ,WAAWrV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQqH,GAAR,CAAY,OAAZ,EAAqBgP,SAArB;AACArW,oBAAQwW,QAAR;;AAEA,mBAAO;AACHzH,sBAAU,CAAC,IAAI0H,IAAJ,EADR;AAEHnO,uBAAUA,KAFP;AAGHoO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BtX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqByW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATtX,MAA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CAArB;AAAA,UACIoN,eAAe,KAAK1b,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIgS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK1b,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bpb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f637ef3bf2395ab6380c","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 8e5a2dcd9d8b458bd05e","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,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,mBAAO,KAAKjJ,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC6J,QAAQ7H,SAAR,CAAkB8H,OAAvB,EACID,QAAQ7H,SAAR,CAAkB8H,OAAlB,GAA4BD,QAAQ7H,SAAR,CAAkB+H,iBAAlB,IACxBF,QAAQ7H,SAAR,CAAkBgI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ7H,SAAR,CAAkBiI,OAAvB,EACIJ,QAAQ7H,SAAR,CAAkBiI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIhG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASgG,eAAT,CAAyBC,QAAzB,CAAkClG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG4F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOhG,EAAP;AACnBA,aAAKA,GAAGmG,aAAH,IAAoBnG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKvb,MAAL,CAAYsT,OAAZ,CAAoBqF,IAApB;AACA,WAAK3Y,MAAL,CAAYsT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK7Y,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKxb,MAAL,CAAYuI,KAAZ,CAAkBkT,SAAlB,CAA4B,KAAKzb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIoN,eAAe,KAAK1b,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIgS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK1b,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bpb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8e5a2dcd9d8b458bd05e","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 72d096f46..5fdadb64b 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -54,6 +54,15 @@ export default class Caret extends Module { offset = nodeToSet.length; } + + /** if found deepest node is native input */ + if ($.isNativeInput(nodeToSet)) { + + nodeToSet.focus(); + return; + + } + /** * @todo try to fix via Promises or use querySelectorAll to not to use timeout */ From 24a7b9cf0f03ab3c0f5148a1642943ec1bafd292 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 17:49:06 +0300 Subject: [PATCH 25/33] improve backspace --- build/codex-editor.js | 135 ++++++++++++++++++++------------ build/codex-editor.js.map | 2 +- src/components/dom.js | 14 +++- src/components/modules/caret.js | 18 +++++ src/components/selection.js | 24 +++--- 5 files changed, 126 insertions(+), 67 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 9476805f8..3a73c513d 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -416,10 +416,20 @@ var Dom = function () { _createClass(Dom, null, [{ key: 'isSingleTag', - value: function isSingleTag(tagName) { - return tagName && ['BR', 'HR', 'IMG'].includes(tagName); + + /** + * Check if passed tag has no closed tag + * @param {Element} tag + * @return {Boolean} + */ + value: function isSingleTag(tag) { + + return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName); } + }, { + key: 'make', + /** * Helper for making Elements with classname and attributes @@ -429,9 +439,6 @@ var Dom = function () { * @param {Object} attributes - any attributes * @return {Element} */ - - }, { - key: 'make', value: function make(tagName) { var classNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -565,7 +572,7 @@ var Dom = function () { /** * special case when child is single tag that can't contain any content */ - if (Dom.isSingleTag(nodeChild.tagName)) { + if (Dom.isSingleTag(nodeChild)) { /** * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest @@ -752,7 +759,7 @@ module.exports = exports['default']; Object.defineProperty(exports, "__esModule", { - value: true + value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -764,68 +771,76 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons */ var Selection = function () { - /** - * @constructor - */ - function Selection() { - _classCallCheck(this, Selection); + /** + * @constructor + */ + function Selection() { + _classCallCheck(this, Selection); + + this.instance = null; + this.selection = null; + } + + /** + * Returns window Selection + * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection} + * @return {Selection} + */ - this.instance = null; - this.selection = null; + + _createClass(Selection, null, [{ + key: "get", + value: function get() { + + return window.getSelection(); } /** - * Returns window Selection - * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection} - * @return {Selection} + * Returns selected anchor + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} + * @return {Node|null} */ + }, { + key: "getAnchorNode", + value: function getAnchorNode() { - _createClass(Selection, null, [{ - key: "get", - value: function get() { - - return window.getSelection(); - } - - /** - * Returns selected anchor - * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} - * @return {Node} - */ + var selection = window.getSelection(); - }, { - key: "getAnchorNode", - value: function getAnchorNode() { + return selection ? selection.anchorNode : null; + } - var selection = window.getSelection(); + /** + * Returns selection offset according to the anchor node + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} + * @return {Number|null} + */ - if (selection) { + }, { + key: "getAnchorOffset", + value: function getAnchorOffset() { - return selection.anchorNode; - } - } + var selection = window.getSelection(); - /** - * Returns selection offset according to the anchor node - * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} - * @return {Number} - */ + return selection ? selection.anchorOffset : null; + } - }, { - key: "getAnchorOffset", - value: function getAnchorOffset() { + /** + * Is current selection range collapsed + * @return {boolean|null} + */ - var selection = window.getSelection(); + }, { + key: "isCollapsed", + get: function get() { - if (selection) { + var selection = window.getSelection(); - return selection.anchorOffset; - } - } - }]); + return selection ? selection.isCollapsed : null; + } + }]); - return Selection; + return Selection; }(); Selection.displayName = "Selection"; @@ -2643,6 +2658,14 @@ var Caret = function (_Module) { key: 'isAtStart', get: function get() { + /** + * Don't handle ranges + */ + if (!_Selection2.default.isCollapsed) { + + return false; + } + var selection = _Selection2.default.get(), anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); @@ -2679,6 +2702,14 @@ var Caret = function (_Module) { key: 'isAtEnd', get: function get() { + /** + * Don't handle ranges + */ + if (!_Selection2.default.isCollapsed) { + + return false; + } + var selection = _Selection2.default.get(), anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 5c6a8ad08..e93c4b33f 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 8e5a2dcd9d8b458bd05e","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","tag","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sB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GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAATxW,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKyW,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqByW,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATtX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK0K,KAAL,GAAa;AACToC,qBAAS,IADA;AAETyK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK/M,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW6M,YAAX,GAA0BxK,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkBiK,YAAhC,CAA1B;AACA,iBAAK7M,KAAL,CAAW8M,eAAX,GAA6BzK,EAAEC,IAAF,CAAO,KAAP,EAAcsK,cAAchK,GAAd,CAAkB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A;AACA;;AAEA;;AAEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKvb,MAAL,CAAYsT,OAAZ,CAAoBqF,IAApB;AACA,WAAK3Y,MAAL,CAAYsT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK7Y,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIyB,iBAAiB,KAAKxb,MAAL,CAAYuI,KAAZ,CAAkBkT,SAAlB,CAA4B,KAAKzb,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIoN,eAAe,KAAK1b,MAAL,CAAYyI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIgS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK1b,MAAL,CAAYsT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bpb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB6I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAu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;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8e5a2dcd9d8b458bd05e","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n static isSingleTag(tagName) {\n\n return tagName && ['BR', 'HR', 'IMG'].includes(tagName);\n\n }\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild.tagName)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorNode;\n\n }\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n if (selection) {\n\n return selection.anchorOffset;\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 495c3e5512f19a767acf","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AAC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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC+J,QAAQ/H,SAAR,CAAkBgI,OAAvB,EACID,QAAQ/H,SAAR,CAAkBgI,OAAlB,GAA4BD,QAAQ/H,SAAR,CAAkBiI,iBAAlB,IACxBF,QAAQ/H,SAAR,CAAkBkI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ/H,SAAR,CAAkBmI,OAAvB,EACIJ,QAAQ/H,SAAR,CAAkBmI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACpBA;;;;AACA;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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKxb,MAAL,CAAYwT,OAAZ,CAAoBqF,IAApB;AACA,WAAK7Y,MAAL,CAAYwT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAK/Y,MAAL,CAAYwT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAKzb,MAAL,CAAYyI,KAAZ,CAAkBiT,SAAlB,CAA4B,KAAK1b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACImN,eAAe,KAAK3b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAI+R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK3b,MAAL,CAAYwT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Btb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB+I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 495c3e5512f19a767acf","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index ccec73bde..833b48c2a 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -3,11 +3,17 @@ */ export default class Dom { - static isSingleTag(tagName) { + /** + * Check if passed tag has no closed tag + * @param {Element} tag + * @return {Boolean} + */ + static isSingleTag(tag) { - return tagName && ['BR', 'HR', 'IMG'].includes(tagName); + return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName); + + }; - } /** * Helper for making Elements with classname and attributes @@ -131,7 +137,7 @@ export default class Dom { /** * special case when child is single tag that can't contain any content */ - if (Dom.isSingleTag(nodeChild.tagName)) { + if (Dom.isSingleTag(nodeChild)) { /** * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 5fdadb64b..8fa971086 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -201,6 +201,15 @@ export default class Caret extends Module { */ get isAtStart() { + /** + * Don't handle ranges + */ + if (!Selection.isCollapsed) { + + return false; + + } + let selection = Selection.get(), anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); @@ -235,6 +244,15 @@ export default class Caret extends Module { */ get isAtEnd() { + /** + * Don't handle ranges + */ + if (!Selection.isCollapsed) { + + return false; + + } + let selection = Selection.get(), anchorNode = selection.anchorNode, lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true); diff --git a/src/components/selection.js b/src/components/selection.js index 838f23f11..67b3b42d4 100644 --- a/src/components/selection.js +++ b/src/components/selection.js @@ -27,34 +27,38 @@ export default class Selection { /** * Returns selected anchor * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} - * @return {Node} + * @return {Node|null} */ static getAnchorNode() { let selection = window.getSelection(); - if (selection) { - - return selection.anchorNode; - - } + return selection ? selection.anchorNode : null; } /** * Returns selection offset according to the anchor node * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} - * @return {Number} + * @return {Number|null} */ static getAnchorOffset() { let selection = window.getSelection(); - if (selection) { + return selection ? selection.anchorOffset : null; + + } + + /** + * Is current selection range collapsed + * @return {boolean|null} + */ + static get isCollapsed() { - return selection.anchorOffset; + let selection = window.getSelection(); - } + return selection ? selection.isCollapsed : null; } From beeecba089ff93f630a6728d6f3bb657102aa270 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 18:23:55 +0300 Subject: [PATCH 26/33] Debug tree walker --- build/codex-editor.js | 15 ++++++++------- build/codex-editor.js.map | 2 +- src/components/dom.js | 4 ++++ src/components/modules/blockManager.js | 2 -- src/components/modules/caret.js | 6 ++++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 3a73c513d..76beaf3ac 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -693,6 +693,8 @@ var Dom = function () { var treeWalker = [], leafs = []; + console.warn('check', node); + if (!node) { return true; @@ -726,6 +728,8 @@ var Dom = function () { */ if (node && !this.isNodeEmpty(node)) { + console.log('NOT EMPTY!!!!!!!!!', node); + return false; } @@ -1387,10 +1391,6 @@ var _block = __webpack_require__(8); var _block2 = _interopRequireDefault(_block); -var _Selection = __webpack_require__(3); - -var _Selection2 = _interopRequireDefault(_Selection); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -1981,7 +1981,6 @@ var Blocks = function () { index = this.length - 1; } - // this.blocks[index].html; this.blocks[index].html.remove(); this.blocks.splice(index, 1); } @@ -2681,9 +2680,11 @@ var Caret = function (_Module) { var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), nothingAtLeft = leftSiblings.every(function (node) { - return node.textContent.length === 0; + return $.isEmpty(node); }); + console.log('nothing at left?', nothingAtLeft); + if (nothingAtLeft && selection.anchorOffset === 0) { return true; @@ -2725,7 +2726,7 @@ var Caret = function (_Module) { var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'), nothingAtRight = leftSiblings.every(function (node) { - return node.textContent.length === 0; + return $.isEmpty(node); }); if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) { diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index e93c4b33f..adf2acec9 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 495c3e5512f19a767acf","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","isLeaf","nextSibling","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAA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BAAKZ,aAAL,GAAqB5V,MAArB;AAEH;AAEJ;;;8BAkCYkW,W,EAAaC,Y,EAAc;;AAEpC,gBAAIM,cAAcd,UAAUQ,YAAV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCnW,M;;;kBAAlB4V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAE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AAJ,EADR;AAEHnO,uBAAUA,KAFP;AAGHoO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8BxX,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB2W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAATxX,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK4K,KAAL,GAAa;AACToC,qBAAS,IADA;AAETyK,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAK/M,KAAL,CAAWoC,OAAX,GAA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Fb,OAAP;AAKH;;;;EAzE2Btb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB+I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAA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;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 495c3e5512f19a767acf","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\nimport Selection from '../Selection';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n // this.blocks[index].html;\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 1bee655a3a300defdfcd","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","warn","isNodeEmpty","push","isLeaf","nextSibling","log","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mC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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACgK,QAAQhI,SAAR,CAAkBiI,OAAvB,EACID,QAAQhI,SAAR,CAAkBiI,OAAlB,GAA4BD,QAAQhI,SAAR,CAAkBkI,iBAAlB,IACxBF,QAAQhI,SAAR,CAAkBmI,qBADtB;;AAGJ,IAAI,CAACH,QAAQhI,SAAR,CAAkBoI,OAAvB,EACIJ,QAAQhI,SAAR,CAAkBoI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIlG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASkG,eAAT,CAAyBC,QAAzB,CAAkCpG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG8F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOlG,EAAP;AACnBA,aAAKA,GAAGqG,aAAH,IAAoBrG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACpBA;;;;;;;;;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKzb,MAAL,CAAYyT,OAAZ,CAAoBqF,IAApB;AACA,WAAK9Y,MAAL,CAAYyT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKhZ,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK1b,MAAL,CAAY0I,KAAZ,CAAkBiT,SAAlB,CAA4B,KAAK3b,MAAL,CAAY4I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACImN,eAAe,KAAK5b,MAAL,CAAY4I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAI+R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK5b,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bvb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBgJ,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1bee655a3a300defdfcd","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n console.warn('check', node);\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n console.log('NOT EMPTY!!!!!!!!!', node);\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n console.log('nothing at left?', nothingAtLeft);\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index 833b48c2a..d4a6b018a 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -258,6 +258,8 @@ export default class Dom { let treeWalker = [], leafs = []; + console.warn('check', node); + if (!node) { return true; @@ -295,6 +297,8 @@ export default class Dom { */ if (node && !this.isNodeEmpty(node)) { + console.log('NOT EMPTY!!!!!!!!!', node); + return false; } diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index ddfef30c5..309d8eb98 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -8,7 +8,6 @@ */ import Block from '../block'; -import Selection from '../Selection'; /** * @typedef {BlockManager} BlockManager @@ -541,7 +540,6 @@ class Blocks { } - // this.blocks[index].html; this.blocks[index].html.remove(); this.blocks.splice(index, 1); diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 8fa971086..dea8b6d62 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -224,7 +224,9 @@ export default class Caret extends Module { if ($.isEmpty(firstNode)) { let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), - nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 ); + nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) ); + + console.log('nothing at left?', nothingAtLeft); if (nothingAtLeft && selection.anchorOffset === 0) { @@ -267,7 +269,7 @@ export default class Caret extends Module { if ($.isEmpty(lastNode)) { let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'), - nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 ); + nothingAtRight = leftSiblings.every( node => $.isEmpty(node) ); if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) { From 5c08edae771cd8869b22dfbb410f7eb751443d19 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 18:59:32 +0300 Subject: [PATCH 27/33] fix tree walker --- build/codex-editor.js | 27 +++++++++++++++------------ build/codex-editor.js.map | 2 +- src/components/dom.js | 17 ++++++++--------- src/components/modules/caret.js | 11 ++++++++--- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 76beaf3ac..19e5bbc1c 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -693,8 +693,6 @@ var Dom = function () { var treeWalker = [], leafs = []; - console.warn('check', node); - if (!node) { return true; @@ -705,10 +703,14 @@ var Dom = function () { return this.isNodeEmpty(node); } - treeWalker.push(node); + treeWalker.push(node.firstChild); while (treeWalker.length > 0) { + node = treeWalker.shift(); + + if (!node) continue; + if (this.isLeaf(node)) { leafs.push(node); @@ -728,17 +730,13 @@ var Dom = function () { */ if (node && !this.isNodeEmpty(node)) { - console.log('NOT EMPTY!!!!!!!!!', node); - return false; } - node = treeWalker.shift(); - - if (!node) continue; + if (node.firstChild) { - node = node.firstChild; - treeWalker.push(node); + treeWalker.push(node.firstChild); + } } return leafs.every(function (leaf) { @@ -2683,9 +2681,14 @@ var Caret = function (_Module) { return $.isEmpty(node); }); - console.log('nothing at left?', nothingAtLeft); + /** + * Workaround case when caret in the text link " |Hello!" + * selection.anchorOffset is 1, but real caret visible position is 0 + * @type {number} + */ + var firstLetterPosition = anchorNode.textContent.search(/\S/); - if (nothingAtLeft && selection.anchorOffset === 0) { + if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { return true; } diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index adf2acec9..14b2d70a1 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 1bee655a3a300defdfcd","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","warn","isNodeEmpty","push","isLeaf","nextSibling","log","shift","firstChild","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAE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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACgK,QAAQhI,SAAR,CAAkBiI,OAAvB,EACID,QAAQhI,SAAR,CAAkBiI,OAAlB,GAA4BD,QAAQhI,SAAR,CAAkBkI,iBAAlB,IACxBF,QAAQhI,SAAR,CAAkBmI,qBADtB;;AAGJ,IAAI,CAACH,QAAQhI,SAAR,CAAkBoI,OAAvB,EACIJ,QAAQhI,SAAR,CAAkBoI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIlG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASkG,eAAT,CAAyBC,QAAzB,CAAkCpG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG8F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOlG,EAAP;AACnBA,aAAKA,GAAGqG,aAAH,IAAoBrG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAKzb,MAAL,CAAYyT,OAAZ,CAAoBqF,IAApB;AACA,WAAK9Y,MAAL,CAAYyT,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKhZ,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK1b,MAAL,CAAY0I,KAAZ,CAAkBiT,SAAlB,CAA4B,KAAK3b,MAAL,CAAY4I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACImN,eAAe,KAAK5b,MAAL,CAAY4I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAI+R,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK5b,MAAL,CAAYyT,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bvb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBgJ,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B,mBAAmB,KAAK,gCAAgC,gCAAgC,qBAAqB,0BAA0B,2BAA2B,OAAO,6BAA6B,4BAA4B,kBAAkB,mBAAmB,kCAAkC,qCAAqC,qBAAqB,sBAAsB,kBAAkB,KAAK,eAAe,yBAAyB,qCAAqC,2BAA2B,GAAG,uBAAuB,qBAAqB,8BAA8B,OAAO,uBAAuB,gCAAgC,2BAA2B,oBAAoB,8BAA8B,sBAAsB,uBAAuB,8BAA8B,2BAA2B,6BAA6B,kCAAkC,+BAA+B,2BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1bee655a3a300defdfcd","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n console.warn('check', node);\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node);\n\n while ( treeWalker.length > 0 ) {\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n console.log('NOT EMPTY!!!!!!!!!', node);\n\n return false;\n\n }\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n node = node.firstChild;\n treeWalker.push(node);\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n console.log('nothing at left?', nothingAtLeft);\n\n if (nothingAtLeft && selection.anchorOffset === 0) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap f684ce9988a2b6d1963d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,OAAP,CAAgBH,IAAhB,CAA5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mJ,YAAZ,GAA2BnJ,OAAOmJ,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAKnJ,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC+J,QAAQ/H,SAAR,CAAkBgI,OAAvB,EACID,QAAQ/H,SAAR,CAAkBgI,OAAlB,GAA4BD,QAAQ/H,SAAR,CAAkBiI,iBAAlB,IACxBF,QAAQ/H,SAAR,CAAkBkI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ/H,SAAR,CAAkBmI,OAAvB,EACIJ,QAAQ/H,SAAR,CAAkBmI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GA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P;AAEH;;;;EA3GkCrW,M;;;kBAAlB8V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,k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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK4K,KAAL,GAAa;AACToC,qBAAS,IADA;AAET2K,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKjN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW+M,YAAX,GAA0B1K,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,C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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB+I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yB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A;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f684ce9988a2b6d1963d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n if ( node.firstChild ) {\n\n treeWalker.push(node.firstChild);\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index d4a6b018a..6aac5a6e2 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -258,8 +258,6 @@ export default class Dom { let treeWalker = [], leafs = []; - console.warn('check', node); - if (!node) { return true; @@ -272,10 +270,14 @@ export default class Dom { } - treeWalker.push(node); + treeWalker.push(node.firstChild); while ( treeWalker.length > 0 ) { + node = treeWalker.shift(); + + if (!node) continue; + if ( this.isLeaf(node) ) { leafs.push(node); @@ -297,18 +299,15 @@ export default class Dom { */ if (node && !this.isNodeEmpty(node)) { - console.log('NOT EMPTY!!!!!!!!!', node); - return false; } - node = treeWalker.shift(); + if ( node.firstChild ) { - if (!node) continue; + treeWalker.push(node.firstChild); - node = node.firstChild; - treeWalker.push(node); + } } diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index dea8b6d62..9729f5ebc 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -226,9 +226,14 @@ export default class Caret extends Module { let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) ); - console.log('nothing at left?', nothingAtLeft); - - if (nothingAtLeft && selection.anchorOffset === 0) { + /** + * Workaround case when caret in the text link " |Hello!" + * selection.anchorOffset is 1, but real caret visible position is 0 + * @type {number} + */ + let firstLetterPosition = anchorNode.textContent.search(/\S/); + + if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { return true; From f8043ff95964ce28ff2652e175197e9c694954a0 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 19:15:24 +0300 Subject: [PATCH 28/33] small caret fix --- build/codex-editor.js | 6 ++++++ build/codex-editor.js.map | 2 +- src/components/modules/caret.js | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 19e5bbc1c..6a5772e14 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -2688,6 +2688,12 @@ var Caret = function (_Module) { */ var firstLetterPosition = anchorNode.textContent.search(/\S/); + if (firstLetterPosition === -1) { + // empty text + + firstLetterPosition = 0; + } + if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { return true; diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 14b2d70a1..bd44db3fc 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap f684ce9988a2b6d1963d","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAA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AAZ;AAAA,gBACIiO,YAAY,CADhB;;AAGAzW,oBAAQ0W,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBlS,OAAjB,CAAyB,UAACuS,UAAD,EAAazK,KAAb,EAAuB;;AAE5C;AACAlM,wBAAQuH,GAAR,UAAgBoP,WAAWzI,IAA3B,uBAAgDyI,UAAhD;AACAF,6BAAaE,WAAW1H,IAAxB;AACAzG,sBAAMxC,IAAN,CAAW2Q,WAAWzV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQuH,GAAR,CAAY,OAAZ,EAAqBkP,SAArB;AACAzW,oBAAQ4W,QAAR;;AAEA,mBAAO;AACH3H,sBAAU,CAAC,IAAI4H,IAAJ,EADR;AAEHrO,uBAAUA,KAFP;AAGHsO,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B1X,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK3b,MAAL,CAAYyI,KAAZ,CAAkBmT,SAAlB,CAA4B,KAAK5b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIqN,eAAe,KAAK7b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIiS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f684ce9988a2b6d1963d","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n if ( node.firstChild ) {\n\n treeWalker.push(node.firstChild);\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap cb33a3d5c1054ece6451","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC+J,QAAQ/H,SAAR,CAAkBgI,OAAvB,EACID,QAAQ/H,SAAR,CAAkBgI,OAAlB,GAA4BD,QAAQ/H,SAAR,CAAkBiI,iBAAlB,IACxBF,QAAQ/H,SAAR,CAAkBkI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ/H,SAAR,CAAkBmI,OAAvB,EACIJ,QAAQ/H,SAAR,CAAkBmI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACpBA;;;;;;;;;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;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK6W,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAAIpM,SAAS,KAAKtK,MAAL,CAAY2I,YAAZ,C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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK4K,KAAL,GAAa;AACToC,qBAAS,IADA;AAET2K,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKjN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW+M,YAAX,GAA0B1K,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBmK,YAAhC,CAA1B;AACA,iBAAK/M,KAAL,CAAWgN,eAAX,GAA6B3K,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBoK,eAAhC,CAA7B;;AAEA3K,cAAEE,MAAF,CAAS,KAAKvC,KAAL,CAAWoC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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK1b,MAAL,CAAY0T,OAAZ,CAAoBqF,IAApB;AACA,WAAK/Y,MAAL,CAAY0T,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKjZ,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK3b,MAAL,CAAYyI,KAAZ,CAAkBmT,SAAlB,CAA4B,KAAK5b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIqN,eAAe,KAAK7b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIiS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB+I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,KAAK,6FAA6F,yBAAyB,eAAe,aAAa,8BAA8B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[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cb33a3d5c1054ece6451","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n if ( node.firstChild ) {\n\n treeWalker.push(node.firstChild);\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 9729f5ebc..1483028ec 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -233,6 +233,12 @@ export default class Caret extends Module { */ let firstLetterPosition = anchorNode.textContent.search(/\S/); + if (firstLetterPosition === -1) { // empty text + + firstLetterPosition = 0; + + } + if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { return true; From 3ac9ee917679083208807afd4ce67ba9787d0ceb Mon Sep 17 00:00:00 2001 From: Murod Khaydarov Date: Tue, 29 May 2018 19:28:23 +0300 Subject: [PATCH 29/33] queue ordering --- build/codex-editor.js | 226 +++++++++++++++++++------------------- build/codex-editor.js.map | 2 +- src/components/dom.js | 10 +- 3 files changed, 117 insertions(+), 121 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 6a5772e14..2518e72d4 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -61,7 +61,7 @@ var CodexEditor = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 4); +/******/ return __webpack_require__(__webpack_require__.s = 3); /******/ }) /************************************************************************/ /******/ ([ @@ -714,6 +714,9 @@ var Dom = function () { if (this.isLeaf(node)) { leafs.push(node); + } else { + + treeWalker.push(node.firstChild); } while (node && node.nextSibling) { @@ -732,11 +735,6 @@ var Dom = function () { return false; } - - if (node.firstChild) { - - treeWalker.push(node.firstChild); - } } return leafs.every(function (leaf) { @@ -757,102 +755,6 @@ module.exports = exports['default']; /* 3 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * Working with selection - */ -var Selection = function () { - - /** - * @constructor - */ - function Selection() { - _classCallCheck(this, Selection); - - this.instance = null; - this.selection = null; - } - - /** - * Returns window Selection - * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection} - * @return {Selection} - */ - - - _createClass(Selection, null, [{ - key: "get", - value: function get() { - - return window.getSelection(); - } - - /** - * Returns selected anchor - * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} - * @return {Node|null} - */ - - }, { - key: "getAnchorNode", - value: function getAnchorNode() { - - var selection = window.getSelection(); - - return selection ? selection.anchorNode : null; - } - - /** - * Returns selection offset according to the anchor node - * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} - * @return {Number|null} - */ - - }, { - key: "getAnchorOffset", - value: function getAnchorOffset() { - - var selection = window.getSelection(); - - return selection ? selection.anchorOffset : null; - } - - /** - * Is current selection range collapsed - * @return {boolean|null} - */ - - }, { - key: "isCollapsed", - get: function get() { - - var selection = window.getSelection(); - - return selection ? selection.isCollapsed : null; - } - }]); - - return Selection; -}(); - -Selection.displayName = "Selection"; -exports.default = Selection; -module.exports = exports["default"]; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; /* WEBPACK VAR INJECTION */(function(_) {/** * Codex Editor @@ -926,7 +828,7 @@ module.exports = exports["default"]; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -__webpack_require__(5); +__webpack_require__(4); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -935,7 +837,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons */ // eslint-disable-next-line var modules = ["blockManager.js","caret.js","events.js","keyboard.js","listeners.js","renderer.js","sanitizer.js","saver.js","toolbar-blockSettings.js","toolbar-toolbox.js","toolbar.js","tools.js","ui.js"].map(function (module) { - return __webpack_require__(6)("./" + module); + return __webpack_require__(5)("./" + module); }); /** @@ -1311,7 +1213,7 @@ module.exports = function () { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1338,12 +1240,12 @@ if (!Element.prototype.closest) Element.prototype.closest = function (s) { }; /***/ }), -/* 6 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { var map = { - "./blockManager.js": 7, - "./caret.js": 9, + "./blockManager.js": 6, + "./caret.js": 8, "./events.js": 10, "./keyboard.js": 11, "./listeners.js": 12, @@ -1370,10 +1272,10 @@ webpackContext.keys = function webpackContextKeys() { }; webpackContext.resolve = webpackContextResolve; module.exports = webpackContext; -webpackContext.id = 6; +webpackContext.id = 5; /***/ }), -/* 7 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1385,7 +1287,7 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _block = __webpack_require__(8); +var _block = __webpack_require__(7); var _block2 = _interopRequireDefault(_block); @@ -2123,7 +2025,7 @@ module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(2), __webpack_require__(1))) /***/ }), -/* 8 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2416,7 +2318,7 @@ module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1))) /***/ }), -/* 9 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2428,7 +2330,7 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _Selection = __webpack_require__(3); +var _Selection = __webpack_require__(9); var _Selection2 = _interopRequireDefault(_Selection); @@ -2756,6 +2658,102 @@ exports.default = Caret; module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(2), __webpack_require__(1))) +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Working with selection + */ +var Selection = function () { + + /** + * @constructor + */ + function Selection() { + _classCallCheck(this, Selection); + + this.instance = null; + this.selection = null; + } + + /** + * Returns window Selection + * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection} + * @return {Selection} + */ + + + _createClass(Selection, null, [{ + key: "get", + value: function get() { + + return window.getSelection(); + } + + /** + * Returns selected anchor + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode} + * @return {Node|null} + */ + + }, { + key: "getAnchorNode", + value: function getAnchorNode() { + + var selection = window.getSelection(); + + return selection ? selection.anchorNode : null; + } + + /** + * Returns selection offset according to the anchor node + * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset} + * @return {Number|null} + */ + + }, { + key: "getAnchorOffset", + value: function getAnchorOffset() { + + var selection = window.getSelection(); + + return selection ? selection.anchorOffset : null; + } + + /** + * Is current selection range collapsed + * @return {boolean|null} + */ + + }, { + key: "isCollapsed", + get: function get() { + + var selection = window.getSelection(); + + return selection ? selection.isCollapsed : null; + } + }]); + + return Selection; +}(); + +Selection.displayName = "Selection"; +exports.default = Selection; +module.exports = exports["default"]; + /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index bd44db3fc..358b6dd97 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap cb33a3d5c1054ece6451","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/components/Selection.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","Selection","instance","selection","getSelection","anchorNode","anchorOffset","isCollapsed","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","lastNode","nothingAtRight","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAAC+J,QAAQ/H,SAAR,CAAkBgI,OAAvB,EACID,QAAQ/H,SAAR,CAAkBgI,OAAlB,GAA4BD,QAAQ/H,SAAR,CAAkBiI,iBAAlB,IACxBF,QAAQ/H,SAAR,CAAkBkI,qBADtB;;AAGJ,IAAI,CAACH,QAAQ/H,SAAR,CAAkBmI,OAAvB,EACIJ,QAAQ/H,SAAR,CAAkBmI,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAIjG,KAAK,IAAT;;AAEA,QAAI,CAACC,SAASiG,eAAT,CAAyBC,QAAzB,CAAkCnG,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAG6F,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAOjG,EAAP;AACnBA,aAAKA,GAAGoG,aAAH,IAAoBpG,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK6W,MAAL,GAAc,IAAd;AACA,cAAKC,UAAL,GAAkB,EAAlB;;AALkB;AAOrB;;AAED;;;;;;;;+BAIO;AAAA;;AAEH,gBAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK4K,KAAL,GAAa;AACToC,qBAAS,IADA;AAET2K,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKjN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAW+M,YAAX,GAA0B1K,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBmK,YAAhC,CAA1B;AACA,iBAAK/M,KAAL,CAAWgN,eAAX,GAA6B3K,EAAEC,IAAF,CAAO,KAAP,EAAcwK,cAAclK,GAAd,CAAkBoK,eAAhC,CAA7B;;AAEA3K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IA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK1b,MAAL,CAAY0T,OAAZ,CAAoBqF,IAApB;AACA,WAAK/Y,MAAL,CAAY0T,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKjZ,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK3b,MAAL,CAAYyI,KAAZ,CAAkBmT,SAAlB,CAA4B,KAAK5b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCW,IAAlE,CAArB;AAAA,UACIqN,eAAe,KAAK7b,MAAL,CAAY2I,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIiS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqB+I,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6B,4BAA4B,mBAAmB,sBAAsB,qBAAqB,uBAAuB,yBAAyB,KAAK,6BAA6B,sBAAsB,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D,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cb33a3d5c1054ece6451","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n if ( node.firstChild ) {\n\n treeWalker.push(node.firstChild);\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 7,\n\t\"./caret.js\": 9,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 6\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 76dbd9f2b1db4d660093","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACwJ,QAAQxH,SAAR,CAAkByH,OAAvB,EACID,QAAQxH,SAAR,CAAkByH,OAAlB,GAA4BD,QAAQxH,SAAR,CAAkB0H,iBAAlB,IACxBF,QAAQxH,SAAR,CAAkB2H,qBADtB;;AAGJ,IAAI,CAACH,QAAQxH,SAAR,CAAkB4H,OAAvB,EACIJ,QAAQxH,SAAR,CAAkB4H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI1F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS0F,eAAT,CAAyBC,QAAzB,CAAkC5F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGsF,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO1F,EAAP;AACnBA,aAAKA,GAAG6F,aAAH,IAAoB7F,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sB;;;;;;;;;;;;;;;ACpBA;;;;;;;;;;+eATA;;;;;;;;;AAWA;;;;;IAKqBqE,Y;;;AAEjB;;;;AAIA,gCAAsB;AAAA,YAATxI,MAAS,QAATA,MA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B;AAEH,aAPD;;AASAlB,oBAAQgH,GAAR,CAAY,OAAZ,EAAqByP,SAArB;AACAzW,oBAAQ4W,QAAR;;AAEA,mBAAO;AACHjI,sBAAU,CAAC,IAAIkI,IAAJ,EADR;AAEH5O,uBAAUA,KAFP;AAGH6O,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B1X,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqK,KAAL,GAAa;AACToC,qBAAS,IADA;AAETkL,0BAAc,IAFL;AAGTC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AK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBwI,E;;;;;;;;ACrDr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BAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 76dbd9f2b1db4d660093","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/dom.js b/src/components/dom.js index 6aac5a6e2..53de18c75 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -282,6 +282,10 @@ export default class Dom { leafs.push(node); + } else { + + treeWalker.push(node.firstChild); + } while ( node && node.nextSibling ) { @@ -303,12 +307,6 @@ export default class Dom { } - if ( node.firstChild ) { - - treeWalker.push(node.firstChild); - - } - } return leafs.every( leaf => this.isNodeEmpty(leaf) ); From 1f30fa2260020b1a9ca9216684e461a79c8163c1 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 20:28:23 +0300 Subject: [PATCH 30/33] update bundle --- build/codex-editor.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index 358b6dd97..e900accec 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 76dbd9f2b1db4d660093","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,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AV,CAAlB;;AAEA,mBAAOM,YAAYL,KAAZ,CAAkBF,WAAlB,CAAP;AAEH;;;;EA3GkCrW,M;;;kBAAlB8V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqK,KAAL,GAAa;AACToC,qBAAS,IADA;AAETkL,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKxN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAc+K,cAAczK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAWsN,YAAX,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A;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBwI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,O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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 76dbd9f2b1db4d660093","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 68df5d432f2d17ce4c96","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACwJ,QAAQxH,SAAR,CAAkByH,OAAvB,EACID,QAAQxH,SAAR,CAAkByH,OAAlB,GAA4BD,QAAQxH,SAAR,CAAkB0H,iBAAlB,IACxBF,QAAQxH,SAAR,CAAkB2H,qBADtB;;AAGJ,IAAI,CAACH,QAAQxH,SAAR,CAAkB4H,OAAvB,EACIJ,QAAQxH,SAAR,CAAkB4H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI1F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS0F,eAAT,CAAyBC,QAAzB,CAAkC5F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGsF,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO1F,EAAP;AACnBA,aAAKA,GAAG6F,aAAH,IAAoB7F,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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B,UAACuS,UAAD,EAAahL,KAAb,EAAuB;;AAE5C;AACA3L,wBAAQgH,GAAR,UAAgB2P,WAAW/I,IAA3B,uBAAgD+I,UAAhD;AACAF,6BAAaE,WAAWhI,IAAxB;AACA1G,sBAAMjC,IAAN,CAAW2Q,WAAWzV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQgH,GAAR,CAAY,OAAZ,EAAqByP,SAArB;AACAzW,oBAAQ4W,QAAR;;AAEA,mBAAO;AACHjI,sBAAU,CAAC,IAAIkI,IAAJ,EADR;AAEH5O,uBAAUA,KAFP;AAGH6O,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B1X,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;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CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCY,IAAlE,CAArB;AAAA,UACI2N,eAAe,KAAK7b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIwS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 68df5d432f2d17ce4c96","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file From 373579c27a29ce206e8fa621307b2f1722dd2ce2 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 20:39:31 +0300 Subject: [PATCH 31/33] improve first letter checkup --- build/codex-editor.js | 28 ++++++++++++++-------------- build/codex-editor.js.map | 2 +- src/components/modules/caret.js | 26 ++++++++++++++------------ 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index 2518e72d4..e29a17934 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -2569,6 +2569,19 @@ var Caret = function (_Module) { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + /** + * Workaround case when caret in the text link " |Hello!" + * selection.anchorOffset is 1, but real caret visible position is 0 + * @type {number} + */ + var firstLetterPosition = anchorNode.textContent.search(/\S/); + + if (firstLetterPosition === -1) { + // empty text + + firstLetterPosition = 0; + } + /** * In case of *

    @@ -2583,26 +2596,13 @@ var Caret = function (_Module) { return $.isEmpty(node); }); - /** - * Workaround case when caret in the text link " |Hello!" - * selection.anchorOffset is 1, but real caret visible position is 0 - * @type {number} - */ - var firstLetterPosition = anchorNode.textContent.search(/\S/); - - if (firstLetterPosition === -1) { - // empty text - - firstLetterPosition = 0; - } - if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { return true; } } - return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === firstLetterPosition; } /** diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index e900accec..ac30cdd69 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 68df5d432f2d17ce4c96","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","leftSiblings","getHigherLevelSiblings","nothingAtLeft","firstLetterPosition","search","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AA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AYoJ,KAA7C;AAAoD;AAApD;AAEH,aAJD,MAIO;;AAEH,qBAAKpJ,MAAL,CAAY4I,YAAZ,GAA2B5I,OAAO4I,YAAlC;AAEH;AAEJ;;AAED;;;;AArHJ;AAAA,4BAyHwB;;AAEhB,mBAAO,KAAK5I,MAAZ;AAEH;AA7HL;;AAAA;AAAA;;AAoPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACwJ,QAAQxH,SAAR,CAAkByH,OAAvB,EACID,QAAQxH,SAAR,CAAkByH,OAAlB,GAA4BD,QAAQxH,SAAR,CAAkB0H,iBAAlB,IACxBF,QAAQxH,SAAR,CAAkB2H,qBADtB;;AAGJ,IAAI,CAACH,QAAQxH,SAAR,CAAkB4H,OAAvB,EACIJ,QAAQxH,SAAR,CAAkB4H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI1F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS0F,eAAT,CAAyBC,QAAzB,CAAkC5F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGsF,OAAH,CAAWI,CAAX,CAAJ,E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AEG,UAAC6V,UAAD,EAAgB;;AAElB,uBAAOA,UAAP;AAEH,aANE,CAAP;AAQH;;AAED;;;;;;;;mCAKWF,gB,EAAkB;;AAEzB,gBAAIrO,QAAQ,EAAZ;AAAA,gBACIwO,YAAY,CADhB;;AAGAzW,oBAAQ0W,cAAR,CAAuB,uBAAvB;;AAEAJ,6BAAiBlS,OAAjB,CAAyB,UAACuS,UAAD,EAAahL,KAAb,EAAuB;;AAE5C;AACA3L,wBAAQgH,GAAR,UAAgB2P,WAAW/I,IAA3B,uBAAgD+I,UAAhD;AACAF,6BAAaE,WAAWhI,IAAxB;AACA1G,sBAAMjC,IAAN,CAAW2Q,WAAWzV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQgH,GAAR,CAAY,OAAZ,EAAqByP,SAArB;AACAzW,oBAAQ4W,QAAR;;AAEA,mBAAO;AACHjI,sBAAU,CAAC,IAAIkI,IAAJ,EADR;AAEH5O,uBAAUA,KAFP;AAGH6O,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B1X,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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Y0T,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKjZ,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK3b,MAAL,CAAYkI,KAAZ,CAAkB0T,SAAlB,CAA4B,KAAK5b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCY,IAAlE,CAArB;AAAA,UACI2N,eAAe,KAAK7b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIwS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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BAA2B,sBAAsB,uBAAuB,0BAA0B,wDAAwD,wDAAwD,wCAAwC,2BAA2B,uBAAuB,4BAA4B,KAAK,gBAAgB,4BAA4B,iBAAiB,kBAAkB,GAAG,wBAAwB,qBAAqB,KAAK,6BAA6B,8BAA8B,mBAAmB,6BAA6B,qCAAqC,iCAAiC,kBAAkB,sBAAsB,KAAK,8BAA8B,8BAA8B,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 68df5d432f2d17ce4c96","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n * \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 9ecf03370a375cff60da","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","firstLetterPosition","search","leftSiblings","getHigherLevelSiblings","nothingAtLeft","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial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AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAAA,kHAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAK6W,MAAL,GAAc,IAAd;AACA,c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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqK,KAAL,GAAa;AACToC,qBAAS,IADA;AAETkL,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKxN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAc+K,cAAczK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAWsN,YAAX,GAA0BjL,EAAEC,IAAF,CAAO,KAAP,EAAc+K,cAAczK,GAAd,CAAkB0K,YAAhC,CAA1B;AACA,iBAAKtN,KAAL,CAAWuN,eAAX,GAA6BlL,E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,iBAAlB;AAEH;;AAGD;;;AAGA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,WAAK1b,MAAL,CAAY0T,OAAZ,CAAoBqF,IAApB;AACA,WAAK/Y,MAAL,CAAY0T,OAAZ,CAAoBuF,IAApB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA,WAAKjZ,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BgB,IAA/B;;AAEA;;;;;AAKA,UAAIwB,iBAAiB,KAAK3b,MAAL,CAAYkI,KAAZ,CAAkB0T,SAAlB,CAA4B,KAAK5b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCY,IAAlE,CAArB;AAAA,UACI2N,eAAe,KAAK7b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIwS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBwI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBAAyB,+BAA+B,4BAA4B,gCAAgC,kBAAkB,mBAAmB,wBAAwB,yBAAyB,6BAA6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ACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9ecf03370a375cff60da","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === firstLetterPosition;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index 1483028ec..cd9030faf 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -214,6 +214,19 @@ export default class Caret extends Module { anchorNode = selection.anchorNode, firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); + /** + * Workaround case when caret in the text link " |Hello!" + * selection.anchorOffset is 1, but real caret visible position is 0 + * @type {number} + */ + let firstLetterPosition = anchorNode.textContent.search(/\S/); + + if (firstLetterPosition === -1) { // empty text + + firstLetterPosition = 0; + + } + /** * In case of *

    @@ -226,18 +239,7 @@ export default class Caret extends Module { let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'), nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) ); - /** - * Workaround case when caret in the text link " |Hello!" - * selection.anchorOffset is 1, but real caret visible position is 0 - * @type {number} - */ - let firstLetterPosition = anchorNode.textContent.search(/\S/); - - if (firstLetterPosition === -1) { // empty text - firstLetterPosition = 0; - - } if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) { @@ -247,7 +249,7 @@ export default class Caret extends Module { } - return firstNode === null || anchorNode === firstNode && selection.anchorOffset === 0; + return firstNode === null || anchorNode === firstNode && selection.anchorOffset === firstLetterPosition; } From 9c303ed3d53a7b776d6e0aad8a83c4df8177e9cf Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 20:40:11 +0300 Subject: [PATCH 32/33] doc upd --- src/components/modules/caret.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/modules/caret.js b/src/components/modules/caret.js index cd9030faf..88fbff060 100644 --- a/src/components/modules/caret.js +++ b/src/components/modules/caret.js @@ -215,7 +215,7 @@ export default class Caret extends Module { firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); /** - * Workaround case when caret in the text link " |Hello!" + * Workaround case when caret in the text like " |Hello!" * selection.anchorOffset is 1, but real caret visible position is 0 * @type {number} */ From 51a5ffe0de4bb43aa3707b5bedb266722594f67b Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 29 May 2018 20:58:37 +0300 Subject: [PATCH 33/33] update current block index setter --- build/codex-editor.js | 6 ++---- build/codex-editor.js.map | 2 +- src/components/modules/blockManager.js | 1 + src/components/modules/keyboard.js | 3 --- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/build/codex-editor.js b/build/codex-editor.js index e29a17934..dd72ae63b 100644 --- a/build/codex-editor.js +++ b/build/codex-editor.js @@ -1527,6 +1527,7 @@ var BlockManager = function (_Module) { }).then(function () { _this4.removeBlock(blockToMergeIndex); + _this4.currentBlockIndex = _this4._blocks.indexOf(targetBlock); }); } @@ -2570,7 +2571,7 @@ var Caret = function (_Module) { firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent); /** - * Workaround case when caret in the text link " |Hello!" + * Workaround case when caret in the text like " |Hello!" * selection.anchorOffset is 1, but real caret visible position is 0 * @type {number} */ @@ -3031,9 +3032,6 @@ var Keyboard = function (_Module) { BM.mergeBlocks(targetBlock, blockToMerge).then(function () { - // decrease current block index so that to know current actual - BM.currentBlockIndex--; - window.setTimeout(function () { // set caret to the block without offset at the end diff --git a/build/codex-editor.js.map b/build/codex-editor.js.map index ac30cdd69..66253bfcf 100644 --- a/build/codex-editor.js.map +++ b/build/codex-editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 9ecf03370a375cff60da","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","firstLetterPosition","search","leftSiblings","getHigherLevelSiblings","nothingAtLeft","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AAEd,WAAKA,MAAL,GAAcA,MAAd;AAEH;;;;;;;kBAtCgBL,M;;;;;;;;;;;;;;;;;;ACTrB;;;IAGqBM,I;;;;;;;;;AAEjB;;;;;;;4BAOWC,G,EAAKC,I,EAAMC,I,EAAM;;AAExBD,mBAAOA,QAAQ,KAAf;;AAEA,gBAAI,CAACC,IAAL,EAAW;;AAEPA,uBAAQF,OAAO,WAAf;AACAA,sBAAO,yBAAP;AAEH,aALD,MAKO;;AAEHA,sBAAO,0BAA0BA,GAAjC;AAEH;;AAED,gBAAG;;AAEC,oBAAK,aAAaG,MAAb,IAAuBA,OAAOC,OAAP,CAAgBH,IAAhB,CAA5B,EAAqD;;AAEjD,wBAAKC,IAAL,EAA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CAAP;AAEH;;;;EA3GkCrW,M;;;kBAAlB8V,S;;;;;;;;AClCrB;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iCAAiC,EAAE;AAC3D,6BAA6B,uEAAuE,EAAE;;AAEtG;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,QAAQ;;AAExB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;;;;;;;;;;ACxLD;;;;;;;;AAQA;;;;;;;AAOA;;;;;;;;IAQqBe,K;;;AAEjB;;;;AAIA,yBAAsB;AAAA,YAAT5W,MAAS,QAATA,MAAS;;AAAA;;AAA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;;;;;;;;IAWqBc,a;;;AAEjB,iCAAsB;AAAA,YAAT1X,MAAS,QAATA,MAAS;;AAAA;;AAAA,kIAEZ,EAACA,cAAD,EAFY;;AAIlB,cAAKqK,KAAL,GAAa;AACToC,qBAAS,IADA;AAETkL,0BAAc,IAFL;AAGTC,6BAAiB,IAHR;AAITC,0BAAc;AAJL,SAAb;;AAJkB;AAWrB;;AAED;;;;;;;;;;AAkBA;;;;;;;+BAOO;;AAEH,iBAAKxN,KAAL,CAAWoC,OAAX,GAAqBC,EAAEC,IAAF,CAAO,KAAP,EAAc+K,cAAczK,GAAd,CAAkBR,OAAhC,CAArB;;AAEA,iBAAKpC,KAAL,CAAWsN,YAAX,GAA0BjL,EAAEC,IAAF,CAAO,KAAP,EAAc+K,cAAczK,GAAd,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAngBqBwI,E;;;;;;;;ACrDrB;AACA;;;AAGA;AACA,gCAAiC,yPAAyP,4CAA4C,yBAAyB,6BAA6B,mBAAmB,6BAA6B,GAAG,uBAAuB,wBAAwB,OAAO,2BAA2B,gCAAgC,OAAO,eAAe,uBAAuB,YAAY,aAAa,WAAW,iBAAiB,2BAA2B,qCAAqC,oCAAoC,kBAAkB,GAAG,uBAAuB,qBAAqB,mBAAmB,8BAA8B,OAAO,wBAAwB,uBAAuB,qBAAqB,yBAAyB,KAAK,qBAAqB,yBA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;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9ecf03370a375cff60da","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n * \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * Workaround case when caret in the text link \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === firstLetterPosition;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n // decrease current block index so that to know current actual\n BM.currentBlockIndex--;\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap eb08a6ca55871472e45f","webpack:///./src/components/__module.js","webpack:///./src/components/utils.js","webpack:///./src/components/dom.js","webpack:///./src/codex.js","webpack:///./src/components/polyfills.js","webpack:///./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$","webpack:///./src/components/modules/blockManager.js","webpack:///./src/components/block.js","webpack:///./src/components/modules/caret.js","webpack:///./src/components/Selection.js","webpack:///./src/components/modules/events.js","webpack:///./src/components/modules/keyboard.js","webpack:///./src/components/modules/listeners.js","webpack:///./src/components/modules/renderer.js","webpack:///./src/components/modules/sanitizer.js","webpack:///./node_modules/html-janitor/src/html-janitor.js","webpack:///./src/components/modules/saver.js","webpack:///./src/components/modules/toolbar-blockSettings.js","webpack:///./src/components/modules/toolbar-toolbox.js","webpack:///./src/components/modules/toolbar.js","webpack:///./src/components/modules/tools.js","webpack:///./src/components/modules/ui.js","webpack:///./src/styles/main.css","webpack:///./node_modules/css-loader/lib/css-base.js"],"names":["Module","config","new","target","TypeError","Editor","Util","msg","type","args","window","console","e","chains","success","fallback","Promise","resolve","reduce","previousValue","currentValue","iteration","then","waitNextBlock","length","chainData","successCallback","fallbackCallback","function","data","catch","collection","Array","prototype","slice","call","object","Object","keys","constructor","element","contentEditable","method","timeout","context","arguments","setTimeout","apply","BACKSPACE","TAB","ENTER","SHIFT","CTRL","ALT","ESC","SPACE","LEFT","UP","DOWN","RIGHT","DELETE","META","Dom","tag","tagName","includes","classNames","attributes","el","document","createElement","isArray","classList","add","attrName","content","createTextNode","parent","elements","forEach","appendChild","selector","querySelector","querySelectorAll","node","atLast","child","sibling","nodeType","Node","ELEMENT_NODE","nodeChild","isSingleTag","parentNode","getDeepestNode","nativeInputs","nodeText","isElement","isNativeInput","value","textContent","replace","trim","childNodes","treeWalker","leafs","isNodeEmpty","push","firstChild","shift","isLeaf","nextSibling","every","leaf","modules","editorModules","map","module","exports","moduleInstances","configuration","init","start","log","error","constructModules","configureModules","displayName","name","state","getModulesDiff","diff","moduleName","prepareDecorator","prepare","Tools","UI","BlockManager","Renderer","render","items","initialBlock","holderId","placeholder","sanitizer","p","b","a","hideToolbar","tools","toolsConfig","_","isEmpty","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","documentElement","contains","parentElement","_blocks","currentBlockIndex","blocks","Blocks","nodes","redactor","Proxy","set","get","toolName","toolInstance","construct","block","bindEvents","Listeners","on","pluginsContent","event","Keyboard","blockKeydownsListener","caretAtEnd","Caret","isAtEnd","nextBlock","setToBlock","caretAtStart","isAtStart","previousBlock","composeBlock","targetBlock","blockToMerge","blockToMergeIndex","indexOf","blockToMergeInfo","mergeWith","removeBlock","index","remove","extractedFragment","extractFragmentFromCaretPosition","wrapper","$","make","append","text","innerHTML","insert","firstLevelBlock","CSS","childNode","parentFirstLevelBlock","currentNode","Error","isLastBlock","isFirstBlock","array","selected","currentBlock","workingArea","html","deleteCount","splice","insertAdjacentElement","newBlock","children","instance","isNaN","Number","Block","tool","_html","compose","contentNode","methodName","params","Function","merge","extractedBlock","save","measuringStart","performance","now","measuringEnd","finishedExtraction","time","isValid","validate","contentless","emptyText","emptyMedia","hasMedia","mediaTags","join","offset","atEnd","focus","nodeToSet","delay","range","createRange","selection","setStart","setEnd","removeAllRanges","addRange","lastBlock","rangeCount","selectRange","getRangeAt","blockElem","deleteContents","cloneRange","selectNodeContents","endContainer","endOffset","extractContents","from","direction","current","siblings","isCollapsed","anchorNode","firstNode","firstLetterPosition","search","leftSiblings","getHigherLevelSiblings","nothingAtLeft","anchorOffset","lastNode","nothingAtRight","Selection","getSelection","Events","subscribers","eventName","callback","previousData","currentHandler","newData","keyCode","keyCodes","backspacePressed","enterPressed","arrowRightAndDownPressed","arrowLeftAndUpPressed","enableLineBreaks","shiftKey","split","preventDefault","BM","canMergeBlocks","getBlockByIndex","mergeable","navigatePrevious","setCaretToTheEnd","mergeBlocks","Toolbar","close","navigateNext","allListeners","eventType","handler","useCapture","assignedEventData","alreadyExist","findOne","addEventListener","existingListeners","findAll","i","removeEventListener","listenersOnElement","listener","listenersWithType","listenersWithHandler","foundListeners","foundAllListeners","foundByElements","foundByEventType","foundByHandler","findByElement","findByType","findByHandler","concat","insertBlock","sequence","item","Sanitizer","defaultConfig","_sanitizerInstance","sanitizerConfig","settings","sanitizerInstance","require","taintString","customConfig","clean","library","tags","href","rel","newInstance","Saver","output","blocksData","all","allExtractedData","makeOutput","outputData","totalTime","groupCollapsed","extraction","groupEnd","Date","version","VERSION","BlockSettings","toolSettings","defaultSettings","buttonRemove","addDefaultSettings","button","removeBlockButtonClicked","wrapperOpened","addToolSettings","Toolbox","toolbox","buttons","opened","addTools","toolsAvailable","addTool","displayInToolbox","iconClassName","toolboxButton","title","dataset","buttonClicked","toolButton","toolClasses","irreplaceable","move","toolboxOpened","open","actions","plusButton","blockActionsButtons","settingsToggler","toolbar","plusButtonClicked","defaultToolbarHeight","defaultOffset","newYCoordinate","offsetTop","style","transform","Math","floor","toolbarOpened","toggle","settingsTogglerClicked","hide","plusButtonHidden","show","toolsUnavailable","hasOwnProperty","reject","sequenceData","getListOfPrepareFunctions","toolPreparationList","toolClass","plugin","available","holder","loadStyles","getElementById","editorWrapper","editorZone","styles","toString","head","redactorClicked","clickedNode","setCurrentBlockByChildNode","setToTheLastBlock","isInitialBlock","isInitial","isEmptyBlock"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;AC7DA;;;;;;;;;IASqBA,M;;AAEjB;;;;;AAKA,oBAA6B;AAAA,mFAAJ,EAAI;AAAA,QAAfC,MAAe,QAAfA,MAAe;;AAAA;;AAEzB,QAAIC,IAAIC,MAAJ,KAAeH,MAAnB,EAA2B;;AAEvB,YAAM,IAAII,SAAJ,CAAc,yDAAd,CAAN;AAEH;;AAED;;;AAGA,SAAKH,MAAL,GAAcA,MAAd;;AAEA;;;AAGA,SAAKI,MAAL,GAAc,IAAd;AAEH;;AAED;;;;;;;;;;;sBAOUA,M,EAAQ;;AA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,U;;;;;;;;;;ACvbA;;;;;AAKA,IAAI,CAACwJ,QAAQxH,SAAR,CAAkByH,OAAvB,EACID,QAAQxH,SAAR,CAAkByH,OAAlB,GAA4BD,QAAQxH,SAAR,CAAkB0H,iBAAlB,IACxBF,QAAQxH,SAAR,CAAkB2H,qBADtB;;AAGJ,IAAI,CAACH,QAAQxH,SAAR,CAAkB4H,OAAvB,EACIJ,QAAQxH,SAAR,CAAkB4H,OAAlB,GAA4B,UAAUC,CAAV,EAAa;;AAErC,QAAI1F,KAAK,IAAT;;AAEA,QAAI,CAACC,SAAS0F,eAAT,CAAyBC,QAAzB,CAAkC5F,EAAlC,CAAL,EAA4C,OAAO,IAAP;AAC5C,OAAG;;AAEC,YAAIA,GAAGsF,OAAH,CAAWI,CAAX,CAAJ,EAAmB,OAAO1F,EAAP;AACnBA,aAAKA,GAAG6F,aAAH,IAAoB7F,GAAGyB,UAA5B;AAEH,KALD,QAKSzB,OAAO,IALhB;AAMA,WAAO,IAAP;AAEH,CAbD,C;;;;;;ACVJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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UAACuS,UAAD,EAAahL,KAAb,EAAuB;;AAE5C;AACA3L,wBAAQgH,GAAR,UAAgB2P,WAAW/I,IAA3B,uBAAgD+I,UAAhD;AACAF,6BAAaE,WAAWhI,IAAxB;AACA1G,sBAAMjC,IAAN,CAAW2Q,WAAWzV,IAAtB;AAEH,aAPD;;AASAlB,oBAAQgH,GAAR,CAAY,OAAZ,EAAqByP,SAArB;AACAzW,oBAAQ4W,QAAR;;AAEA,mBAAO;AACHjI,sBAAU,CAAC,IAAIkI,IAAJ,EADR;AAEH5O,uBAAUA,KAFP;AAGH6O,yBAAU,OAAAC;AAHP,aAAP;AAMH;;;;EAtE8B1X,M;;AA0EnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;kBAvOqB6W,K;;;;;;;;;;;;;;;;;;;;;;;ACvBrB;;;;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AYoI,YAAZ,CAAyBkF,YAAzB,CAAsCY,IAAlE,CAArB;AAAA,UACI2N,eAAe,KAAK7b,MAAL,CAAYoI,YAAZ,CAAyBkF,YAAzB,CAAsCnE,OADzD;;AAGA,UAAIwS,kBAAkBE,YAAtB,EAAoC;;AAEhC,aAAK7b,MAAL,CAAY0T,OAAZ,CAAoByF,UAApB,CAA+BkB,IAA/B;AAEH;AAEJ;;;wBAxOS;;AAEN,aAAO;AACHa,uBAAgB,cADb;AAEHC,oBAAgB;AAFb,OAAP;AAKH;;;;EAzE2Bxb,M;;AA8ShC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,uBAAuB,sCAAsC,kCAAkC,kBAAkB,sBAAsB,KAAK,wBAAwB,yBAAyB,yBAAyB,8BAA8B,0BAA0B,KAAK,aAAa,4BAA4B,oBAAoB,2BAA2B,oBAAoB,KAAK,uBAAuB,gCAAgC,KAAK,sBAAsB,uBAAuB,qBAAqB,KAAK;;AAE1rH;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA","file":"codex-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap eb08a6ca55871472e45f","/**\n * @abstract\n * @class Module\n * @classdesc All modules inherits from this class.\n *\n * @typedef {Module} Module\n * @property {Object} config - Editor user settings\n * @property {Object} Editor - List of Editor modules\n */\nexport default class Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({ config } = {}) {\n\n if (new.target === Module) {\n\n throw new TypeError('Constructors for abstract class Module are not allowed.');\n\n }\n\n /**\n * @type {EditorConfig}\n */\n this.config = config;\n\n /**\n * @type {EditorComponents}\n */\n this.Editor = null;\n\n }\n\n /**\n * Editor modules setter\n *\n * @param Editor\n * @param Editor.modules {@link CodexEditor#moduleInstances}\n * @param Editor.config {@link CodexEditor#configuration}\n */\n set state(Editor) {\n\n this.Editor = Editor;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/__module.js","/**\n * Codex Editor Util\n */\nexport default class Util {\n\n /**\n * Custom logger\n *\n * @param {string} msg - message\n * @param {string} type - logging type 'log'|'warn'|'error'|'info'\n * @param {*} args - argument to log with a message\n */\n static log(msg, type, args) {\n\n type = type || 'log';\n\n if (!args) {\n\n args = msg || 'undefined';\n msg = '[codex-editor]: %o';\n\n } else {\n\n msg = '[codex-editor]: ' + msg;\n\n }\n\n try{\n\n if ( 'console' in window && window.console[ type ] ) {\n\n if ( args ) window.console[ type ]( msg, args );\n else window.console[ type ]( msg );\n\n }\n\n } catch(e) {\n // do nothing\n }\n\n }\n\n /**\n * Returns basic keycodes as constants\n * @return {{}}\n */\n static get keyCodes() {\n\n return {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n LEFT: 37,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n DELETE: 46,\n META: 91\n };\n\n }\n\n /**\n * @typedef {Object} ChainData\n * @property {Object} data - data that will be passed to the success or fallback\n * @property {Function} function - function's that must be called asynchronically\n */\n\n /**\n * Fires a promise sequence asyncronically\n *\n * @param {Object[]} chains - list or ChainData's\n * @param {Function} success - success callback\n * @param {Function} fallback - callback that fires in case of errors\n *\n * @return {Promise}\n */\n static sequence(chains, success = () => {}, fallback = () => {}) {\n\n return new Promise(function (resolve) {\n\n /**\n * pluck each element from queue\n * First, send resolved Promise as previous value\n * Each plugins \"prepare\" method returns a Promise, that's why\n * reduce current element will not be able to continue while can't get\n * a resolved Promise\n */\n chains.reduce(function (previousValue, currentValue, iteration) {\n\n return previousValue\n .then(() => waitNextBlock(currentValue, success, fallback))\n .then(() => {\n\n // finished\n if (iteration === chains.length - 1) {\n\n resolve();\n\n }\n\n });\n\n }, Promise.resolve());\n\n });\n\n /**\n * Decorator\n *\n * @param {ChainData} chainData\n *\n * @param {Function} successCallback\n * @param {Function} fallbackCallback\n *\n * @return {Promise}\n */\n function waitNextBlock(chainData, successCallback, fallbackCallback) {\n\n return new Promise(function (resolve) {\n\n chainData.function()\n .then(() => {\n\n successCallback(chainData.data || {});\n\n })\n .then(resolve)\n .catch(function () {\n\n fallbackCallback(chainData.data || {});\n\n // anyway, go ahead even it falls\n resolve();\n\n });\n\n });\n\n }\n\n }\n\n /**\n * Make array from array-like collection\n *\n * @param {*} collection\n *\n * @return {Array}\n */\n static array(collection) {\n\n return Array.prototype.slice.call(collection);\n\n }\n\n /**\n * Checks if object is empty\n *\n * @param {Object} object\n * @return {boolean}\n */\n static isEmpty(object) {\n\n return Object.keys(object).length === 0 && object.constructor === Object;\n\n }\n\n /**\n * Check if passed object is a Promise\n * @param {*} object - object to check\n * @return {Boolean}\n */\n static isPromise(object) {\n\n return Promise.resolve(object) === object;\n\n }\n\n /**\n * Check if passed element is contenteditable\n * @param element\n * @return {boolean}\n */\n static isContentEditable(element) {\n\n return element.contentEditable === 'true';\n\n }\n\n /**\n * Delays method execution\n *\n * @param method\n * @param timeout\n */\n static delay(method, timeout) {\n\n return function () {\n\n let context = this,\n args = arguments;\n\n window.setTimeout(() => method.apply(context, args), timeout);\n\n };\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/utils.js","/**\n * DOM manipulations helper\n */\nexport default class Dom {\n\n /**\n * Check if passed tag has no closed tag\n * @param {Element} tag\n * @return {Boolean}\n */\n static isSingleTag(tag) {\n\n return tag.tagName && ['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'].includes(tag.tagName);\n\n };\n\n\n /**\n * Helper for making Elements with classname and attributes\n *\n * @param {string} tagName - new Element tag name\n * @param {array|string} classNames - list or name of CSS classname(s)\n * @param {Object} attributes - any attributes\n * @return {Element}\n */\n static make(tagName, classNames = null, attributes = {}) {\n\n let el = document.createElement(tagName);\n\n if ( Array.isArray(classNames) ) {\n\n el.classList.add(...classNames);\n\n } else if( classNames ) {\n\n el.classList.add(classNames);\n\n }\n\n for (let attrName in attributes) {\n\n el[attrName] = attributes[attrName];\n\n }\n\n return el;\n\n }\n\n /**\n * Creates Text Node with the passed content\n * @param {String} content - text content\n * @return {Text}\n */\n static text(content) {\n\n return document.createTextNode(content);\n\n }\n\n /**\n * Append one or several elements to the parent\n *\n * @param {Element} parent - where to append\n * @param {Element|Element[]} - element ore elements list\n */\n static append(parent, elements) {\n\n if ( Array.isArray(elements) ) {\n\n elements.forEach( el => parent.appendChild(el) );\n\n } else {\n\n parent.appendChild(elements);\n\n }\n\n }\n\n /**\n * Selector Decorator\n *\n * Returns first match\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n *\n * @returns {Element}\n */\n static find(el = document, selector) {\n\n return el.querySelector(selector);\n\n }\n\n /**\n * Selector Decorator.\n *\n * Returns all matches\n *\n * @param {Element} el - element we searching inside. Default - DOM Document\n * @param {String} selector - searching string\n * @returns {NodeList}\n */\n static findAll(el = document, selector) {\n\n return el.querySelectorAll(selector);\n\n }\n\n /**\n * Search for deepest node which is Leaf.\n * Leaf is the vertex that doesn't have any child nodes\n *\n * @description Method recursively goes throw the all Node until it finds the Leaf\n *\n * @param {Node} node - root Node. From this vertex we start Deep-first search {@link https://en.wikipedia.org/wiki/Depth-first_search}\n * @param {Boolean} atLast - find last text node\n * @return {Node} - it can be text Node or Element Node, so that caret will able to work with it\n */\n static getDeepestNode(node, atLast = false) {\n\n /**\n * Current function have two directions:\n * - starts from first child and every time gets first or nextSibling in special cases\n * - starts from last child and gets last or previousSibling\n * @type {string}\n */\n let child = atLast ? 'lastChild' : 'firstChild',\n sibling = atLast ? 'previousSibling' : 'nextSibling';\n\n if (node && node.nodeType === Node.ELEMENT_NODE && node[child]) {\n\n let nodeChild = node[child];\n\n /**\n * special case when child is single tag that can't contain any content\n */\n if (Dom.isSingleTag(nodeChild)) {\n\n /**\n * 1) We need to check the next sibling. If it is Node Element then continue searching for deepest\n * from sibling\n *\n * 2) If single tag's next sibling is null, then go back to parent and check his sibling\n * In case of Node Element continue searching\n *\n * 3) If none of conditions above happened return parent Node Element\n */\n if (nodeChild[sibling]) {\n\n nodeChild = nodeChild[sibling];\n\n } else if (nodeChild.parentNode[sibling]) {\n\n nodeChild = nodeChild.parentNode[sibling];\n\n } else {\n\n return nodeChild.parentNode;\n\n }\n\n }\n\n return this.getDeepestNode(nodeChild, atLast);\n\n }\n\n return node;\n\n }\n\n /**\n * Check if object is DOM node\n *\n * @param {Object} node\n * @returns {boolean}\n */\n static isElement(node) {\n\n return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;\n\n }\n\n /**\n * Checks target if it is native input\n * @param {Element|String} target - HTML element or string\n * @return {Boolean}\n */\n static isNativeInput(target) {\n\n let nativeInputs = [\n 'INPUT',\n 'TEXTAREA'\n ];\n\n return target ? nativeInputs.includes(target.tagName) : false;\n\n }\n\n /**\n * Checks node if it is empty\n *\n * @description Method checks simple Node without any childs for emptiness\n * If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method\n *\n * @param {Node} node\n * @return {Boolean} true if it is empty\n */\n static isNodeEmpty(node) {\n\n let nodeText;\n\n if ( this.isElement(node) && this.isNativeInput(node) ) {\n\n nodeText = node.value;\n\n } else {\n\n nodeText = node.textContent.replace('\\u200B', '');\n\n }\n\n return nodeText.trim().length === 0;\n\n }\n\n /**\n * checks node if it is doesn't have any child nodes\n * @param {Node} node\n * @return {boolean}\n */\n static isLeaf(node) {\n\n if (!node) {\n\n return false;\n\n }\n\n return node.childNodes.length === 0;\n\n }\n\n /**\n * breadth-first search (BFS)\n * {@link https://en.wikipedia.org/wiki/Breadth-first_search}\n *\n * @description Pushes to stack all DOM leafs and checks for emptiness\n *\n * @param {Node} node\n * @return {boolean}\n */\n static isEmpty(node) {\n\n let treeWalker = [],\n leafs = [];\n\n if (!node) {\n\n return true;\n\n }\n\n if (!node.childNodes.length) {\n\n return this.isNodeEmpty(node);\n\n }\n\n treeWalker.push(node.firstChild);\n\n while ( treeWalker.length > 0 ) {\n\n node = treeWalker.shift();\n\n if (!node) continue;\n\n if ( this.isLeaf(node) ) {\n\n leafs.push(node);\n\n } else {\n\n treeWalker.push(node.firstChild);\n\n }\n\n while ( node && node.nextSibling ) {\n\n node = node.nextSibling;\n\n if (!node) continue;\n\n treeWalker.push(node);\n\n }\n\n /**\n * If one of childs is not empty, checked Node is not empty too\n */\n if (node && !this.isNodeEmpty(node)) {\n\n return false;\n\n }\n\n }\n\n return leafs.every( leaf => this.isNodeEmpty(leaf) );\n\n }\n\n};\n\n\n// WEBPACK FOOTER //\n// ./src/components/dom.js","/**\n * Codex Editor\n *\n * Short Description (눈_눈;)\n * @version 2.0.0\n *\n * How to start?\n * Example:\n * new CodexEditor({\n * holderId : 'codex-editor',\n * initialBlock : 'text',\n * placeholder : 'Write your story....',\n * tools: {\n * quote: Quote,\n * anotherTool : AnotherTool\n * },\n * toolsConfig: {\n * quote: {\n * iconClassname : 'quote-icon',\n * displayInToolbox : true,\n * enableLineBreaks : true\n * },\n * anotherTool: {\n * iconClassname : 'tool-icon'\n * }\n * }\n * });\n *\n * - tools is an object: {\n * pluginName: PluginClass,\n * .....\n * }\n * - toolsConfig is an additional configuration that uses Codex Editor API\n * iconClassname - CSS classname of toolbox icon\n * displayInToolbox - if you want to see your Tool in toolbox hided in \"plus\" button, than set \"True\". By default : \"False\"\n * enableLineBreaks - by default enter creates new block that set as initialblock, but if you set this property \"True\", enter will break the lines in current block\n *\n * @author CodeX-Team \n *\n */\n\n/**\n * @typedef {CodexEditor} CodexEditor - editor class\n */\n\n/**\n * @typedef {Object} EditorConfig\n * @property {String} holderId - Element to append Editor\n * @property {Array} data - Blocks list in JSON-format\n * @property {Object} tools - Map for used Tools in format { name : Class, ... }\n * @property {String} initialBlock - This Tool will be added by default\n * @property {String} placeholder - First Block placeholder\n * @property {Object} sanitizer - @todo fill desc\n * @property {Boolean} hideToolbar - @todo fill desc\n * @property {Object} toolsConfig - tools configuration {@link tools#ToolConfig}\n */\n\n/**\n * Dynamically imported utils\n *\n * @typedef {Dom} $ - {@link components/dom.js}\n * @typedef {Util} _ - {@link components/utils.js}\n */\n\n'use strict';\n\n/**\n * Apply polyfills\n */\nimport 'components/polyfills';\n\n/**\n * Require Editor modules places in components/modules dir\n */\n// eslint-disable-next-line\nlet modules = editorModules.map( module => require('./components/modules/' + module ));\n\n/**\n * @class\n *\n * @classdesc CodeX Editor base class\n *\n * @property this.config - all settings\n * @property this.moduleInstances - constructed editor components\n *\n * @type {CodexEditor}\n */\nmodule.exports = class CodexEditor {\n\n /** Editor version */\n static get version() {\n\n return VERSION;\n\n }\n\n /**\n * @param {EditorConfig} config - user configuration\n *\n */\n constructor(config) {\n\n /**\n * Configuration object\n * @type {EditorConfig}\n */\n this.config = {};\n\n /**\n * @typedef {Object} EditorComponents\n * @property {BlockManager} BlockManager\n * @property {Tools} Tools\n * @property {Events} Events\n * @property {UI} UI\n * @property {Toolbar} Toolbar\n * @property {Toolbox} Toolbox\n * @property {BlockSettings} BlockSettings\n * @property {Renderer} Renderer\n */\n this.moduleInstances = {};\n\n Promise.resolve()\n .then(() => {\n\n this.configuration = config;\n\n })\n .then(() => this.init())\n .then(() => this.start())\n .then(() => {\n\n console.log('CodeX Editor is ready!');\n\n })\n .catch(error => {\n\n console.log('CodeX Editor does not ready because of %o', error);\n\n });\n\n }\n\n /**\n * Setting for configuration\n * @param {EditorConfig} config\n */\n set configuration(config) {\n\n /**\n * Initlai block type\n * Uses in case when there is no items passed\n * @type {{type: (*), data: {text: null}}}\n */\n let initialBlock = {\n type : config.initialBlock,\n data : {}\n };\n\n this.config.holderId = config.holderId;\n this.config.placeholder = config.placeholder || 'write your story...';\n this.config.sanitizer = config.sanitizer || {\n p: true,\n b: true,\n a: true\n };\n\n this.config.hideToolbar = config.hideToolbar ? config.hideToolbar : false;\n this.config.tools = config.tools || {};\n this.config.toolsConfig = config.toolsConfig || {};\n this.config.data = config.data || {};\n\n /**\n * Initialize items to pass data to the Renderer\n */\n if (_.isEmpty(this.config.data)) {\n\n this.config.data = {};\n this.config.data.items = [ initialBlock ];\n\n } else {\n\n if (!this.config.data.items || this.config.data.items.length === 0) {\n\n this.config.data.items = [ initialBlock ];\n\n }\n\n }\n\n /**\n * If initial Block's Tool was not passed, use the first Tool in config.tools\n */\n if (!config.initialBlock) {\n\n for (this.config.initialBlock in this.config.tools) break;\n\n } else {\n\n this.config.initialBlock = config.initialBlock;\n\n }\n\n }\n\n /**\n * Returns private property\n * @returns {EditorConfig}\n */\n get configuration() {\n\n return this.config;\n\n }\n\n /**\n * Initializes modules:\n * - make and save instances\n * - configure\n */\n init() {\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n this.constructModules();\n\n /**\n * Modules configuration\n */\n this.configureModules();\n\n }\n\n /**\n * Make modules instances and save it to the @property this.moduleInstances\n */\n constructModules() {\n\n modules.forEach( Module => {\n\n try {\n\n /**\n * We use class name provided by displayName property\n *\n * On build, Babel will transform all Classes to the Functions so, name will always be 'Function'\n * To prevent this, we use 'babel-plugin-class-display-name' plugin\n * @see https://www.npmjs.com/package/babel-plugin-class-display-name\n */\n this.moduleInstances[Module.displayName] = new Module({\n config : this.configuration\n });\n\n } catch ( e ) {\n\n console.log('Module %o skipped because %o', Module, e);\n\n }\n\n });\n\n }\n\n /**\n * Modules instances configuration:\n * - pass other modules to the 'state' property\n * - ...\n */\n configureModules() {\n\n for(let name in this.moduleInstances) {\n\n /**\n * Module does not need self-instance\n */\n this.moduleInstances[name].state = this.getModulesDiff( name );\n\n }\n\n }\n\n /**\n * Return modules without passed name\n */\n getModulesDiff( name ) {\n\n let diff = {};\n\n for(let moduleName in this.moduleInstances) {\n\n /**\n * Skip module with passed name\n */\n if (moduleName === name) {\n\n continue;\n\n }\n diff[moduleName] = this.moduleInstances[moduleName];\n\n }\n\n return diff;\n\n }\n\n /**\n * Start Editor!\n *\n * Get list of modules that needs to be prepared and return a sequence (Promise)\n * @return {Promise}\n */\n start() {\n\n let prepareDecorator = module => module.prepare();\n\n return Promise.resolve()\n .then(prepareDecorator(this.moduleInstances.Tools))\n .then(prepareDecorator(this.moduleInstances.UI))\n .then(prepareDecorator(this.moduleInstances.BlockManager))\n .then(() => {\n\n return this.moduleInstances.Renderer.render(this.config.data.items);\n\n\n });\n\n }\n\n};\n\n// module.exports = (function (editor) {\n//\n// 'use strict';\n//\n// editor.version = VERSION;\n// editor.scriptPrefix = 'cdx-script-';\n//\n// var init = function () {\n//\n// editor.core = require('./modules/core');\n// editor.tools = require('./modules/tools');\n// editor.ui = require('./modules/ui');\n// editor.transport = require('./modules/transport');\n// editor.renderer = require('./modules/renderer');\n// editor.saver = require('./modules/saver');\n// editor.content = require('./modules/content');\n// editor.toolbar = require('./modules/toolbar/toolbar');\n// editor.callback = require('./modules/callbacks');\n// editor.draw = require('./modules/draw');\n// editor.caret = require('./modules/caret');\n// editor.notifications = require('./modules/notifications');\n// editor.parser = require('./modules/parser');\n// editor.sanitizer = require('./modules/sanitizer');\n// editor.listeners = require('./modules/listeners');\n// editor.destroyer = require('./modules/destroyer');\n// editor.paste = require('./modules/paste');\n//\n// };\n//\n// /**\n// * @public\n// * holds initial settings\n// */\n// editor.settings = {\n// tools : ['text', 'header', 'picture', 'list', 'quote', 'code', 'twitter', 'instagram', 'smile'],\n// holderId : 'codex-editor',\n//\n// // Type of block showing on empty editor\n// initialBlockPlugin: 'text'\n// };\n//\n// /**\n// * public\n// *\n// * Static nodes\n// */\n// editor.nodes = {\n// holder : null,\n// wrapper : null,\n// toolbar : null,\n// inlineToolbar : {\n// wrapper : null,\n// buttons : null,\n// actions : null\n// },\n// toolbox : null,\n// notifications : null,\n// plusButton : null,\n// showSettingsButton: null,\n// showTrashButton : null,\n// blockSettings : null,\n// pluginSettings : null,\n// defaultSettings : null,\n// toolbarButtons : {}, // { type : DomEl, ... }\n// redactor : null\n// };\n//\n// /**\n// * @public\n// *\n// * Output state\n// */\n// editor.state = {\n// jsonOutput : [],\n// blocks : [],\n// inputs : []\n// };\n//\n// /**\n// * @public\n// * Editor plugins\n// */\n// editor.tools = {};\n//\n// editor.start = function (userSettings) {\n//\n// init();\n//\n// editor.core.prepare(userSettings)\n//\n// // If all ok, make UI, bind events and parse initial-content\n// .then(editor.ui.prepare)\n// .then(editor.tools.prepare)\n// .then(editor.sanitizer.prepare)\n// .then(editor.paste.prepare)\n// .then(editor.transport.prepare)\n// .then(editor.renderer.makeBlocksFromData)\n// .then(editor.ui.saveInputs)\n// .catch(function (error) {\n//\n// editor.core.log('Initialization failed with error: %o', 'warn', error);\n//\n// });\n//\n// };\n//\n// return editor;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/codex.js","/**\n * Element.closest()\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\n */\nif (!Element.prototype.matches)\n Element.prototype.matches = Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nif (!Element.prototype.closest)\n Element.prototype.closest = function (s) {\n\n var el = this;\n\n if (!document.documentElement.contains(el)) return null;\n do {\n\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n\n } while (el !== null);\n return null;\n\n };\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/polyfills.js","var map = {\n\t\"./blockManager.js\": 6,\n\t\"./caret.js\": 8,\n\t\"./events.js\": 10,\n\t\"./keyboard.js\": 11,\n\t\"./listeners.js\": 12,\n\t\"./renderer.js\": 13,\n\t\"./sanitizer.js\": 14,\n\t\"./saver.js\": 16,\n\t\"./toolbar-blockSettings.js\": 17,\n\t\"./toolbar-toolbox.js\": 18,\n\t\"./toolbar.js\": 19,\n\t\"./tools.js\": 20,\n\t\"./ui.js\": 21\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/modules nonrecursive [^_](blockManager.js|caret.js|events.js|keyboard.js|listeners.js|renderer.js|sanitizer.js|saver.js|toolbar-blockSettings.js|toolbar-toolbox.js|toolbar.js|tools.js|ui.js)$\n// module id = 5\n// module chunks = 0","/**\n * @class BlockManager\n * @classdesc Manage editor`s blocks storage and appearance\n *\n * @module BlockManager\n *\n * @version 2.0.0\n */\n\nimport Block from '../block';\n\n/**\n * @typedef {BlockManager} BlockManager\n * @property {Number} currentBlockIndex - Index of current working block\n * @property {Proxy} _blocks - Proxy for Blocks instance {@link Blocks}\n */\nexport default class BlockManager extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Proxy for Blocks instance {@link Blocks}\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = null;\n\n /**\n * Index of current working block\n *\n * @type {number}\n * @private\n */\n this.currentBlockIndex = -1;\n\n }\n\n /**\n * Should be called after Editor.UI preparation\n * Define this._blocks property\n *\n * @returns {Promise}\n */\n prepare() {\n\n return new Promise(resolve => {\n\n let blocks = new Blocks(this.Editor.UI.nodes.redactor);\n\n /**\n * We need to use Proxy to overload set/get [] operator.\n * So we can use array-like syntax to access blocks\n *\n * @example\n * this._blocks[0] = new Block(...);\n *\n * block = this._blocks[0];\n *\n * @todo proxy the enumerate method\n *\n * @type {Proxy}\n * @private\n */\n this._blocks = new Proxy(blocks, {\n set: Blocks.set,\n get: Blocks.get\n });\n\n resolve();\n\n });\n\n }\n\n /**\n * Creates Block instance by tool name\n *\n * @param {String} toolName - tools passed in editor config {@link EditorConfig#tools}\n * @param {Object} data - constructor params\n *\n * @return {Block}\n */\n composeBlock(toolName, data) {\n\n let toolInstance = this.Editor.Tools.construct(toolName, data),\n block = new Block(toolName, toolInstance);\n\n this.bindEvents(block);\n\n /**\n * Apply callback before inserting html\n */\n block.call('appendCallback', {});\n\n return block;\n\n }\n\n /**\n * Bind Events\n * @param {Object} block\n */\n bindEvents(block) {\n\n this.Editor.Listeners.on(block.pluginsContent, 'keydown', (event) => this.Editor.Keyboard.blockKeydownsListener(event));\n\n }\n\n /**\n * Set's caret to the next Block\n * Before moving caret, we should check if caret position is at the end of Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigateNext() {\n\n let caretAtEnd = this.Editor.Caret.isAtEnd;\n\n if (!caretAtEnd) {\n\n return;\n\n }\n\n let nextBlock = this.nextBlock;\n\n if (!nextBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( nextBlock );\n\n\n }\n\n /**\n * Set's caret to the previous Block\n * Before moving caret, we should check if caret position is start of the Plugins node\n * Using {@link Dom#getDeepestNode} to get a last node and match with current selection\n */\n navigatePrevious() {\n\n let caretAtStart = this.Editor.Caret.isAtStart;\n\n if (!caretAtStart) {\n\n return;\n\n }\n\n let previousBlock = this.previousBlock;\n\n if (!previousBlock) {\n\n return;\n\n }\n\n this.Editor.Caret.setToBlock( previousBlock, 0, true );\n\n }\n\n /**\n * Insert new block into _blocks\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n insert(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks[++this.currentBlockIndex] = block;\n this.Editor.Caret.setToBlock(block);\n\n }\n\n /**\n * Merge two blocks\n * @param {Block} targetBlock - previous block will be append to this block\n * @param {Block} blockToMerge - block that will be merged with target block\n *\n * @return {Promise} - the sequence that can be continued\n */\n mergeBlocks(targetBlock, blockToMerge) {\n\n let blockToMergeIndex = this._blocks.indexOf(blockToMerge);\n\n return Promise.resolve()\n .then( () => {\n\n if (blockToMerge.isEmpty) {\n\n return;\n\n }\n\n return blockToMerge.data\n .then((blockToMergeInfo) => {\n\n targetBlock.mergeWith(blockToMergeInfo.data);\n\n });\n\n })\n .then( () => {\n\n this.removeBlock(blockToMergeIndex);\n this.currentBlockIndex = this._blocks.indexOf(targetBlock);\n\n });\n\n\n }\n\n /**\n * Remove block with passed index or remove last\n * @param {Number|null} index\n */\n removeBlock(index) {\n\n this._blocks.remove(index);\n\n }\n /**\n * Split current Block\n * 1. Extract content from Caret position to the Block`s end\n * 2. Insert a new Block below current one with extracted content\n */\n split() {\n\n let extractedFragment = this.Editor.Caret.extractFragmentFromCaretPosition(),\n wrapper = $.make('div');\n\n wrapper.append(extractedFragment);\n\n /**\n * @todo make object in accordance with Tool\n */\n let data = {\n text: $.isEmpty(wrapper) ? '' : wrapper.innerHTML,\n };\n\n this.insert(this.config.initialBlock, data);\n\n }\n\n /**\n * Replace current working block\n *\n * @param {String} toolName — plugin name\n * @param {Object} data — plugin data\n */\n replace(toolName, data = {}) {\n\n let block = this.composeBlock(toolName, data);\n\n this._blocks.insert(this.currentBlockIndex, block, true);\n\n }\n\n /**\n * returns last Block\n * @return {Block}\n */\n get lastBlock() {\n\n return this._blocks[this._blocks.length - 1];\n\n }\n\n /**\n * Returns Block by passed index\n * @param {Number} index\n * @return {Block}\n */\n getBlockByIndex(index) {\n\n return this._blocks[index];\n\n }\n\n /**\n * Get Block instance by html element\n * @param {HTMLElement} element\n * @returns {Block}\n */\n getBlock(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`),\n index = nodes.indexOf(firstLevelBlock);\n\n if (index >= 0) {\n\n return this._blocks[index];\n\n }\n\n }\n\n /**\n * Get current Block instance\n *\n * @return {Block}\n */\n get currentBlock() {\n\n return this._blocks[this.currentBlockIndex];\n\n }\n\n /**\n * Returns next Block instance\n * @return {Block|null}\n */\n get nextBlock() {\n\n let isLastBlock = this.currentBlockIndex === (this._blocks.length - 1);\n\n if (isLastBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex + 1];\n\n }\n\n /**\n * Returns previous Block instance\n * @return {Block|null}\n */\n get previousBlock() {\n\n let isFirstBlock = this.currentBlockIndex === 0;\n\n if (isFirstBlock) {\n\n return null;\n\n }\n\n return this._blocks[this.currentBlockIndex - 1];\n\n }\n\n /**\n * Get working html element\n *\n * @return {HTMLElement}\n */\n get currentNode() {\n\n return this._blocks.nodes[this.currentBlockIndex];\n\n }\n\n /**\n * Set currentBlockIndex to passed block\n * @param {HTMLElement} element\n */\n set currentNode(element) {\n\n let nodes = this._blocks.nodes,\n firstLevelBlock = element.closest(`.${Block.CSS.wrapper}`);\n\n /**\n * Update current Block's index\n * @type {number}\n */\n this.currentBlockIndex = nodes.indexOf(firstLevelBlock);\n\n /**\n * Remove previous selected Block's state\n */\n this._blocks.array.forEach( block => block.selected = false);\n\n /**\n * Mark current Block as selected\n * @type {boolean}\n */\n this.currentBlock.selected = true;\n\n }\n\n /**\n * Get array of Block instances\n *\n * @returns {Block[]} {@link Blocks#array}\n */\n get blocks() {\n\n return this._blocks.array;\n\n }\n\n /**\n * 1) Find first-level Block from passed child Node\n * 2) Mark it as current\n *\n * @param {Element|Text} childNode - look ahead from this node.\n * @throws Error - when passed Node is not included at the Block\n */\n setCurrentBlockByChildNode(childNode) {\n\n /**\n * If node is Text TextNode\n */\n if (!$.isElement(childNode)) {\n\n childNode = childNode.parentNode;\n\n }\n\n let parentFirstLevelBlock = childNode.closest(`.${Block.CSS.wrapper}`);\n\n if (parentFirstLevelBlock) {\n\n this.currentNode = parentFirstLevelBlock;\n\n } else {\n\n throw new Error('Can not find a Block from this child Node');\n\n }\n\n }\n\n}\n\n/**\n * @class Blocks\n * @classdesc Class to work with Block instances array\n *\n * @private\n *\n * @property {HTMLElement} workingArea — editor`s working node\n *\n */\nclass Blocks {\n\n /**\n * @constructor\n *\n * @param {HTMLElement} workingArea — editor`s working node\n */\n constructor(workingArea) {\n\n this.blocks = [];\n this.workingArea = workingArea;\n\n }\n\n /**\n * Push back new Block\n *\n * @param {Block} block\n */\n push(block) {\n\n this.blocks.push(block);\n this.workingArea.appendChild(block.html);\n\n }\n\n /**\n * Insert new Block at passed index\n *\n * @param {Number} index — index to insert Block\n * @param {Block} block — Block to insert\n * @param {Boolean} replace — it true, replace block on given index\n */\n insert(index, block, replace = false) {\n\n if (!this.length) {\n\n this.push(block);\n return;\n\n }\n\n if (index > this.length) {\n\n index = this.length;\n\n }\n\n if (replace) {\n\n this.blocks[index].html.remove();\n\n }\n\n let deleteCount = replace ? 1 : 0;\n\n this.blocks.splice(index, deleteCount, block);\n\n if (index > 0) {\n\n let previousBlock = this.blocks[index - 1];\n\n previousBlock.html.insertAdjacentElement('afterend', block.html);\n\n } else {\n\n let nextBlock = this.blocks[index + 1];\n\n if (nextBlock) {\n\n nextBlock.html.insertAdjacentElement('beforebegin', block.html);\n\n } else {\n\n this.workingArea.appendChild(block.html);\n\n }\n\n }\n\n }\n\n /**\n * Remove block\n * @param {Number|null} index\n */\n remove(index) {\n\n if (!index) {\n\n index = this.length - 1;\n\n }\n\n this.blocks[index].html.remove();\n this.blocks.splice(index, 1);\n\n }\n\n /**\n * Insert Block after passed target\n *\n * @todo decide if this method is necessary\n *\n * @param {Block} targetBlock — target after wich Block should be inserted\n * @param {Block} newBlock — Block to insert\n */\n insertAfter(targetBlock, newBlock) {\n\n let index = this.blocks.indexOf(targetBlock);\n\n this.insert(index + 1, newBlock);\n\n }\n\n /**\n * Get Block by index\n *\n * @param {Number} index — Block index\n * @returns {Block}\n */\n get(index) {\n\n return this.blocks[index];\n\n }\n\n /**\n * Return index of passed Block\n *\n * @param {Block} block\n * @returns {Number}\n */\n indexOf(block) {\n\n return this.blocks.indexOf(block);\n\n }\n\n /**\n * Get length of Block instances array\n *\n * @returns {Number}\n */\n get length() {\n\n return this.blocks.length;\n\n }\n\n /**\n * Get Block instances array\n *\n * @returns {Block[]}\n */\n get array() {\n\n return this.blocks;\n\n }\n\n /**\n * Get blocks html elements array\n *\n * @returns {HTMLElement[]}\n */\n get nodes() {\n\n return _.array(this.workingArea.children);\n\n }\n\n /**\n * Proxy trap to implement array-like setter\n *\n * @example\n * blocks[0] = new Block(...)\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — block index\n * @param {Block} block — Block to set\n * @returns {Boolean}\n */\n static set(instance, index, block) {\n\n if (isNaN(Number(index))) {\n\n return false;\n\n }\n\n instance.insert(index, block);\n\n return true;\n\n }\n\n /**\n * Proxy trap to implement array-like getter\n *\n * @param {Blocks} instance — Blocks instance\n * @param {Number|String} index — Block index\n * @returns {Block|*}\n */\n static get(instance, index) {\n\n if (isNaN(Number(index))) {\n\n return instance[index];\n\n }\n\n return instance.get(index);\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/blockManager.js","/**\n *\n * @class Block\n * @classdesc This class describes editor`s block, including block`s HTMLElement, data and tool\n *\n * @property {Tool} tool — current block tool (Paragraph, for example)\n * @property {Object} CSS — block`s css classes\n *\n */\n\n/**\n * @classdesc Abstract Block class that contains Block information, Tool name and Tool class instance\n *\n * @property tool - Tool instance\n * @property html - Returns HTML content of plugin\n * @property wrapper - Div element that wraps block content with Tool's content. Has `ce-block` CSS class\n * @property contentNode - Div element that wraps Tool's content. Has `ce-block__content` CSS class\n * @property pluginsContent - HTML content that returns by Tool's render function\n */\nexport default class Block {\n\n /**\n * @constructor\n * @param {String} toolName - Tool name that passed on initialization\n * @param {Object} toolInstance — passed Tool`s instance that rendered the Block\n */\n constructor(toolName, toolInstance) {\n\n this.name = toolName;\n this.tool = toolInstance;\n this._html = this.compose();\n\n }\n\n /**\n * CSS classes for the Block\n * @return {{wrapper: string, content: string}}\n */\n static get CSS() {\n\n return {\n wrapper: 'ce-block',\n content: 'ce-block__content',\n selected: 'ce-block--selected'\n };\n\n }\n\n /**\n * Make default Block wrappers and put Tool`s content there\n * @returns {HTMLDivElement}\n */\n compose() {\n\n this.wrapper = $.make('div', Block.CSS.wrapper);\n this.contentNode = $.make('div', Block.CSS.content);\n this.pluginsContent = this.tool.render();\n\n this.contentNode.appendChild(this.pluginsContent);\n this.wrapper.appendChild(this.contentNode);\n\n return this.wrapper;\n\n }\n\n /**\n * Calls Tool's method\n *\n * Method checks tool property {MethodName}. Fires method with passes params If it is instance of Function\n *\n * @param {String} methodName\n * @param {Object} params\n */\n call(methodName, params) {\n\n /**\n * call Tool's method with the instance context\n */\n if (this.tool[methodName] && this.tool[methodName] instanceof Function) {\n\n this.tool[methodName].call(this.tool, params);\n\n }\n\n }\n\n /**\n * Get Block`s HTML\n * @returns {HTMLElement}\n */\n get html() {\n\n return this._html;\n\n }\n\n /**\n * Get Block's JSON data\n * @return {Object}\n */\n get data() {\n\n return this.save();\n\n }\n\n /**\n * is block mergeable\n * We plugin have merge function then we call it mergable\n * @return {boolean}\n */\n get mergeable() {\n\n return typeof this.tool.merge === 'function';\n\n }\n\n /**\n * Call plugins merge method\n * @param {Object} data\n */\n mergeWith(data) {\n\n return Promise.resolve()\n .then(() => {\n\n this.tool.merge(data);\n\n });\n\n }\n /**\n * Extracts data from Block\n * Groups Tool's save processing time\n * @return {Object}\n */\n save() {\n\n let extractedBlock = this.tool.save(this.pluginsContent);\n\n /** Measuring execution time*/\n let measuringStart = window.performance.now(),\n measuringEnd;\n\n return Promise.resolve(extractedBlock)\n .then((finishedExtraction) => {\n\n /** measure promise execution */\n measuringEnd = window.performance.now();\n\n return {\n tool: this.name,\n data: finishedExtraction,\n time : measuringEnd - measuringStart\n };\n\n })\n .catch(function (error) {\n\n _.log(`Saving proccess for ${this.tool.name} tool failed due to the ${error}`, 'log', 'red');\n\n });\n\n }\n\n /**\n * Uses Tool's validation method to check the correctness of output data\n * Tool's validation method is optional\n *\n * @description Method also can return data if it passed the validation\n *\n * @param {Object} data\n * @returns {Boolean|Object} valid\n */\n validateData(data) {\n\n let isValid = true;\n\n if (this.tool.validate instanceof Function) {\n\n isValid = this.tool.validate(data);\n\n }\n\n if (!isValid) {\n\n return false;\n\n }\n\n return data;\n\n }\n\n /**\n * Check block for emptiness\n * @return {Boolean}\n */\n get isEmpty() {\n\n /**\n * Allow Tool to represent decorative contentless blocks: for example \"* * *\"-tool\n * That Tools are not empty\n */\n if (this.tool.contentless) {\n\n return false;\n\n }\n\n let emptyText = $.isEmpty(this.pluginsContent),\n emptyMedia = !this.hasMedia;\n\n return emptyText && emptyMedia;\n\n }\n\n /**\n * Check if block has a media content such as images, iframes and other\n * @return {Boolean}\n */\n get hasMedia() {\n\n /**\n * This tags represents media-content\n * @type {string[]}\n */\n const mediaTags = [\n 'img',\n 'iframe',\n 'video',\n 'audio',\n 'source',\n 'input',\n 'textarea',\n 'twitterwidget'\n ];\n\n return !!this._html.querySelector(mediaTags.join(','));\n\n }\n\n /**\n * Set selected state\n * @param {Boolean} state - 'true' to select, 'false' to remove selection\n */\n set selected(state) {\n\n /**\n * We don't need to mark Block as Selected when it is not empty\n */\n if (state === true && !this.isEmpty) {\n\n this._html.classList.add(Block.CSS.selected);\n\n } else {\n\n this._html.classList.remove(Block.CSS.selected);\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/block.js","/**\n * @class Caret\n * @classdesc Contains methods for working Caret\n *\n * Uses Range methods to manipulate with caret\n *\n * @module Caret\n *\n * @version 2.0.0\n */\n\n/**\n * @typedef {Caret} Caret\n */\nimport Selection from '../Selection';\n\nexport default class Caret extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Method gets Block instance and puts caret to the text node with offset\n * There two ways that method applies caret position:\n * - first found text node: sets at the beginning, but you can pass an offset\n * - last found text node: sets at the end of the node. Also, you can customize the behaviour\n *\n * @param {Block} block - Block class\n * @param {Number} offset - caret offset regarding to the text node\n * @param {Boolean} atEnd - put caret at the end of the text node or not\n */\n setToBlock(block, offset = 0, atEnd = false) {\n\n let element = block.pluginsContent;\n\n /** If Element is INPUT */\n if ($.isNativeInput(element)) {\n\n element.focus();\n return;\n\n }\n\n let nodeToSet = $.getDeepestNode(element, atEnd);\n\n if (atEnd || offset > nodeToSet.length) {\n\n offset = nodeToSet.length;\n\n }\n\n /** if found deepest node is native input */\n if ($.isNativeInput(nodeToSet)) {\n\n nodeToSet.focus();\n return;\n\n }\n\n /**\n * @todo try to fix via Promises or use querySelectorAll to not to use timeout\n */\n _.delay( () => {\n\n this.set(nodeToSet, offset);\n\n }, 20)();\n\n this.Editor.BlockManager.currentNode = block.wrapper;\n\n }\n\n /**\n * Creates Document Range and sets caret to the element with offset\n * @param {Element} element - target node.\n * @param {Number} offset - offset\n */\n set( element, offset = 0) {\n\n let range = document.createRange(),\n selection = Selection.get();\n\n range.setStart(element, offset);\n range.setEnd(element, offset);\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n };\n\n /**\n * Set Caret to the last Block\n * If last block is not empty, append another empty block\n */\n setToTheLastBlock() {\n\n let lastBlock = this.Editor.BlockManager.lastBlock;\n\n if (!lastBlock) return;\n\n /**\n * If last block is empty and it is an initialBlock, set to that.\n * Otherwise, append new empty block and set to that\n */\n if (lastBlock.isEmpty) {\n\n this.setToBlock(lastBlock);\n\n } else {\n\n this.Editor.BlockManager.insert(this.config.initialBlock);\n\n }\n\n }\n\n /**\n * Extract content fragment of current Block from Caret position to the end of the Block\n */\n extractFragmentFromCaretPosition() {\n\n let selection = Selection.get();\n\n if (selection.rangeCount) {\n\n let selectRange = selection.getRangeAt(0),\n blockElem = this.Editor.BlockManager.currentBlock.pluginsContent;\n\n selectRange.deleteContents();\n\n if (blockElem) {\n\n let range = selectRange.cloneRange(true);\n\n range.selectNodeContents(blockElem);\n range.setStart(selectRange.endContainer, selectRange.endOffset);\n return range.extractContents();\n\n }\n\n }\n\n }\n\n /**\n * Get all first-level (first child of [contenteditabel]) siblings from passed node\n * Then you can check it for emptiness\n *\n * @example\n *

    \n *\n * @return {Element[]}\n */\n getHigherLevelSiblings(from, direction ) {\n\n let current = from,\n siblings = [];\n\n /**\n * Find passed node's firs-level parent (in example - blockquote)\n */\n while (current.parentNode && current.parentNode.contentEditable !== 'true') {\n\n current = current.parentNode;\n\n }\n\n let sibling = direction === 'left' ? 'previousSibling' : 'nextSibling';\n\n /**\n * Find all left/right siblings\n */\n while (current[sibling]) {\n\n current = current[sibling];\n siblings.push(current);\n\n }\n\n return siblings;\n\n }\n\n /**\n * Get's deepest first node and checks if offset is zero\n * @return {boolean}\n */\n get isAtStart() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n firstNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent);\n\n /**\n * Workaround case when caret in the text like \" |Hello!\"\n * selection.anchorOffset is 1, but real caret visible position is 0\n * @type {number}\n */\n let firstLetterPosition = anchorNode.textContent.search(/\\S/);\n\n if (firstLetterPosition === -1) { // empty text\n\n firstLetterPosition = 0;\n\n }\n\n /**\n * In case of\n *
    \n *

    <-- first (and deepest) node is \n * |adaddad <-- anchor node\n *
    \n */\n if ($.isEmpty(firstNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),\n nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );\n\n\n\n if (nothingAtLeft && selection.anchorOffset === firstLetterPosition) {\n\n return true;\n\n }\n\n }\n\n return firstNode === null || anchorNode === firstNode && selection.anchorOffset === firstLetterPosition;\n\n }\n\n /**\n * Get's deepest last node and checks if offset is last node text length\n * @return {boolean}\n */\n get isAtEnd() {\n\n /**\n * Don't handle ranges\n */\n if (!Selection.isCollapsed) {\n\n return false;\n\n }\n\n let selection = Selection.get(),\n anchorNode = selection.anchorNode,\n lastNode = $.getDeepestNode(this.Editor.BlockManager.currentBlock.pluginsContent, true);\n\n /**\n * In case of\n *
    \n * adaddad| <-- anchor node\n *

    <-- first (and deepest) node is \n *
    \n */\n if ($.isEmpty(lastNode)) {\n\n let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),\n nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );\n\n if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {\n\n return true;\n\n }\n\n }\n\n return anchorNode === lastNode && selection.anchorOffset === lastNode.textContent.length;\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/caret.js","/**\n * Working with selection\n */\nexport default class Selection {\n\n /**\n * @constructor\n */\n constructor() {\n\n this.instance = null;\n this.selection = null;\n\n }\n\n /**\n * Returns window Selection\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}\n * @return {Selection}\n */\n static get() {\n\n return window.getSelection();\n\n }\n\n /**\n * Returns selected anchor\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}\n * @return {Node|null}\n */\n static getAnchorNode() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorNode : null;\n\n }\n\n /**\n * Returns selection offset according to the anchor node\n * {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}\n * @return {Number|null}\n */\n static getAnchorOffset() {\n\n let selection = window.getSelection();\n\n return selection ? selection.anchorOffset : null;\n\n }\n\n /**\n * Is current selection range collapsed\n * @return {boolean|null}\n */\n static get isCollapsed() {\n\n let selection = window.getSelection();\n\n return selection ? selection.isCollapsed : null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/Selection.js","/**\n * @module eventDispatcher\n *\n * Has two important methods:\n * - {Function} on - appends subscriber to the event. If event doesn't exist - creates new one\n * - {Function} emit - fires all subscribers with data\n *\n * @version 1.0.0\n *\n * @typedef {Events} Events\n * @property {Object} subscribers - all subscribers grouped by event name\n */\nexport default class Events extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n this.subscribers = {};\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Function} callback - subscriber\n */\n on(eventName, callback) {\n\n if (!(eventName in this.subscribers)) {\n\n this.subscribers[eventName] = [];\n\n }\n\n // group by events\n this.subscribers[eventName].push(callback);\n\n }\n\n /**\n * @param {String} eventName - event name\n * @param {Object} data - subscribers get this data when they were fired\n */\n emit(eventName, data) {\n\n this.subscribers[eventName].reduce(function (previousData, currentHandler) {\n\n let newData = currentHandler(previousData);\n\n return newData ? newData : previousData;\n\n }, data);\n\n }\n\n /**\n * Destroyer\n * clears subsribers list\n */\n destroy() {\n\n this.subscribers = null;\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/events.js","/**\n * @class Keyboard\n * @classdesc Сlass to handle the keydowns\n *\n * @author CodeX Team (team@ifmo.su)\n * @copyright CodeX Team 2017\n * @license The MIT License (MIT)\n * @version 1.0.0\n */\n\n/**\n * @typedef {Keyboard} Keyboard\n */\nexport default class Keyboard extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * Handler on Block for keyboard keys at keydown event\n *\n * @param {KeyboardEvent} event\n */\n blockKeydownsListener(event) {\n\n switch(event.keyCode) {\n\n case _.keyCodes.BACKSPACE:\n\n _.log('Backspace key pressed');\n this.backspacePressed(event);\n break;\n\n case _.keyCodes.ENTER:\n\n _.log('Enter key pressed');\n this.enterPressed(event);\n break;\n\n case _.keyCodes.DOWN:\n case _.keyCodes.RIGHT:\n\n _.log('Right/Down key pressed');\n this.arrowRightAndDownPressed();\n break;\n\n case _.keyCodes.UP:\n case _.keyCodes.LEFT:\n\n _.log('Left/Up key pressed');\n this.arrowLeftAndUpPressed();\n break;\n\n default:\n\n break;\n\n }\n\n }\n\n /**\n * Handle pressing enter key\n *\n * @param {KeyboardEvent} event\n */\n enterPressed(event) {\n\n let currentBlock = this.Editor.BlockManager.currentBlock,\n toolsConfig = this.config.toolsConfig[currentBlock.name];\n\n /**\n * Don't handle Enter keydowns when Tool sets enableLineBreaks to true.\n * Uses for Tools like where line breaks should be handled by default behaviour.\n */\n if (toolsConfig && toolsConfig.enableLineBreaks) {\n\n return;\n\n }\n\n /**\n * Allow to create linebreaks by Shift+Enter\n */\n if (event.shiftKey) {\n\n return;\n\n }\n\n\n /**\n * Split the Current Block into two blocks\n */\n this.Editor.BlockManager.split();\n event.preventDefault();\n\n }\n\n /**\n * Handle backspace keypress on block\n * @param {KeyboardEvent} event - keydown\n */\n backspacePressed(event) {\n\n const BM = this.Editor.BlockManager;\n\n let isFirstBlock = BM.currentBlockIndex === 0,\n canMergeBlocks = this.Editor.Caret.isAtStart && !isFirstBlock;\n\n if (!canMergeBlocks) {\n\n return;\n\n }\n\n // preventing browser default behaviour\n event.preventDefault();\n\n let targetBlock = BM.getBlockByIndex(BM.currentBlockIndex - 1),\n blockToMerge = BM.currentBlock;\n\n /**\n * Blocks that can be merged:\n * 1) with the same Name\n * 2) Tool has 'merge' method\n *\n * other case will handle as usual ARROW LEFT behaviour\n */\n if (blockToMerge.name !== targetBlock.name || !targetBlock.mergeable) {\n\n BM.navigatePrevious();\n\n }\n\n let setCaretToTheEnd = !targetBlock.isEmpty ? true : false;\n\n BM.mergeBlocks(targetBlock, blockToMerge)\n .then( () => {\n\n window.setTimeout( () => {\n\n // set caret to the block without offset at the end\n this.Editor.Caret.setToBlock(BM.currentBlock, 0, setCaretToTheEnd);\n this.Editor.Toolbar.close();\n\n }, 10);\n\n });\n\n }\n\n /**\n * Handle right and down keyboard keys\n */\n arrowRightAndDownPressed() {\n\n this.Editor.BlockManager.navigateNext();\n\n }\n\n /**\n * Handle left and up keyboard keys\n */\n arrowLeftAndUpPressed() {\n\n this.Editor.BlockManager.navigatePrevious();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/keyboard.js","/**\n * Codex Editor Listeners module\n *\n * @module Listeners\n *\n * Module-decorator for event listeners assignment\n *\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Listeners} Listeners\n * @property {Array} allListeners\n */\n\nexport default class Listeners extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n this.allListeners = [];\n\n }\n\n /**\n * Assigns event listener on element\n *\n * @param {Element} element - DOM element that needs to be listened\n * @param {String} eventType - event type\n * @param {Function} handler - method that will be fired on event\n * @param {Boolean} useCapture - use event bubbling\n */\n on(element, eventType, handler, useCapture = false) {\n\n let assignedEventData = {\n element,\n eventType,\n handler,\n useCapture\n };\n\n let alreadyExist = this.findOne(element, eventType, handler);\n\n if (alreadyExist) return;\n\n this.allListeners.push(assignedEventData);\n element.addEventListener(eventType, handler, useCapture);\n\n }\n\n /**\n * Removes event listener from element\n *\n * @param {Element} element - DOM element that we removing listener\n * @param {String} eventType - event type\n * @param {Function} handler - remove handler, if element listens several handlers on the same event type\n * @param {Boolean} useCapture - use event bubbling\n */\n off(element, eventType, handler, useCapture = false) {\n\n let existingListeners = this.findAll(element, eventType, handler);\n\n for (let i = 0; i < existingListeners.length; i++) {\n\n let index = this.allListeners.indexOf(existingListeners[i]);\n\n if (index > 0) {\n\n this.allListeners.splice(index, 1);\n\n }\n\n }\n\n element.removeEventListener(eventType, handler, useCapture);\n\n\n }\n\n /**\n * Search method: looks for listener by passed element\n * @param {Element} element - searching element\n * @returns {Array} listeners that found on element\n */\n findByElement(element) {\n\n let listenersOnElement = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.element === element) {\n\n listenersOnElement.push(listener);\n\n }\n\n }\n\n return listenersOnElement;\n\n }\n\n /**\n * Search method: looks for listener by passed event type\n * @param {String} eventType\n * @return {Array} listeners that found on element\n */\n findByType(eventType) {\n\n let listenersWithType = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.type === eventType) {\n\n listenersWithType.push(listener);\n\n }\n\n }\n\n return listenersWithType;\n\n }\n\n /**\n * Search method: looks for listener by passed handler\n * @param {Function} handler\n * @return {Array} listeners that found on element\n */\n findByHandler(handler) {\n\n let listenersWithHandler = [];\n\n for (let i = 0; i < this.allListeners.length; i++) {\n\n let listener = this.allListeners[i];\n\n if (listener.handler === handler) {\n\n listenersWithHandler.push(listener);\n\n }\n\n }\n\n return listenersWithHandler;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Element|null}\n */\n findOne(element, eventType, handler) {\n\n let foundListeners = this.findAll(element, eventType, handler);\n\n return foundListeners.length > 0 ? foundListeners[0] : null;\n\n }\n\n /**\n * @param {Element} element\n * @param {String} eventType\n * @param {Function} handler\n * @return {Array}\n */\n findAll(element, eventType, handler) {\n\n let foundAllListeners,\n foundByElements = [],\n foundByEventType = [],\n foundByHandler = [];\n\n if (element)\n foundByElements = this.findByElement(element);\n\n if (eventType)\n foundByEventType = this.findByType(eventType);\n\n if (handler)\n foundByHandler = this.findByHandler(handler);\n\n foundAllListeners = foundByElements.concat(foundByEventType, foundByHandler);\n\n return foundAllListeners;\n\n }\n\n /**\n * Removes all listeners\n */\n removeAll() {\n\n this.allListeners.map( (current) => {\n\n current.element.removeEventListener(current.eventType, current.handler);\n\n });\n\n this.allListeners = [];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/listeners.js","/**\n * Codex Editor Renderer Module\n *\n * @module Renderer\n * @author CodeX Team\n *\n * @version 2.0.0\n */\nexport default class Renderer extends Module {\n\n /**\n * @constructor\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n }\n\n /**\n * @typedef {Object} RendererItems\n * @property {String} type - tool name\n * @property {Object} data - tool data\n */\n\n /**\n * @example\n *\n * items: [\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Hello from Codex!'\n * }\n * },\n * {\n * type : 'paragraph',\n * data : {\n * text : 'Leave feedback if you like it!'\n * }\n * },\n * ]\n *\n */\n\n /**\n * Make plugin blocks from array of plugin`s data\n * @param {RendererItems[]} items\n */\n render(items) {\n\n let chainData = [];\n\n for (let i = 0; i < items.length; i++) {\n\n chainData.push({\n function: () => this.insertBlock(items[i])\n });\n\n }\n\n return _.sequence(chainData);\n\n }\n\n /**\n * Get plugin instance\n * Add plugin instance to BlockManager\n * Insert block to working zone\n *\n * @param {Object} item\n * @returns {Promise.}\n * @private\n */\n insertBlock(item) {\n\n let tool = item.type,\n data = item.data;\n\n this.Editor.BlockManager.insert(tool, data);\n\n return Promise.resolve();\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/renderer.js","/**\n * CodeX Sanitizer\n *\n * @module Sanitizer\n * Clears HTML from taint tags\n *\n * @version 2.0.0\n *\n * @example\n * Module can be used within two ways:\n * 1) When you have an instance\n * - this.Editor.Sanitizer.clean(yourTaintString);\n * 2) As static method\n * - CodexEditor.Sanitizer.clean(yourTaintString, yourCustomConfiguration);\n *\n * {@link SanitizerConfig}\n */\n\n\n/**\n * @typedef {Object} SanitizerConfig\n * @property {Object} tags - define tags restrictions\n *\n * @example\n *\n * tags : {\n * p: true,\n * a: {\n * href: true,\n * rel: \"nofollow\",\n * target: \"_blank\"\n * }\n * }\n */\nexport default class Sanitizer extends Module {\n\n /**\n * Initializes Sanitizer module\n * Sets default configuration if custom not exists\n *\n * @property {SanitizerConfig} this.defaultConfig\n * @property {HTMLJanitor} this._sanitizerInstance - Sanitizer library\n *\n * @param {SanitizerConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n // default config\n this.defaultConfig = null;\n this._sanitizerInstance = null;\n\n /** Custom configuration */\n this.sanitizerConfig = config.settings ? config.settings.sanitizer : {};\n\n /** HTML Janitor library */\n this.sanitizerInstance = require('html-janitor');\n\n }\n\n /**\n * If developer uses editor's API, then he can customize sanitize restrictions.\n * Or, sanitizing config can be defined globally in editors initialization. That config will be used everywhere\n * At least, if there is no config overrides, that API uses Default configuration\n *\n * @uses https://www.npmjs.com/package/html-janitor\n *\n * @param {HTMLJanitor} library - sanitizer extension\n */\n set sanitizerInstance(library) {\n\n this._sanitizerInstance = new library(this.defaultConfig);\n\n }\n\n /**\n * Sets sanitizer configuration. Uses default config if user didn't pass the restriction\n * @param {SanitizerConfig} config\n */\n set sanitizerConfig(config) {\n\n if (_.isEmpty(config)) {\n\n this.defaultConfig = {\n tags: {\n p: {},\n a: {\n href: true,\n target: '_blank',\n rel: 'nofollow'\n }\n }\n };\n\n } else {\n\n this.defaultConfig = config;\n\n }\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @param {String} taintString - HTML string\n * @param {Object} customConfig - custom sanitizer configuration. Method uses default if param is empty\n * @return {String} clean HTML\n */\n clean(taintString, customConfig = {}) {\n\n if (_.isEmpty(customConfig)) {\n\n return this._sanitizerInstance.clean(taintString);\n\n } else {\n\n return Sanitizer.clean(taintString, customConfig);\n\n }\n\n\n }\n\n /**\n * Cleans string from unwanted tags\n * @static\n *\n * Method allows to use default config\n *\n * @param {String} taintString - taint string\n * @param {SanitizerConfig} customConfig - allowed tags\n *\n * @return {String} clean HTML\n */\n static clean(taintString, customConfig) {\n\n let newInstance = Sanitizer(customConfig);\n\n return newInstance.clean(taintString);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/sanitizer.js","(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('html-janitor', factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.HTMLJanitor = factory();\n }\n}(this, function () {\n\n /**\n * @param {Object} config.tags Dictionary of allowed tags.\n * @param {boolean} config.keepNestedBlockElements Default false.\n */\n function HTMLJanitor(config) {\n\n var tagDefinitions = config['tags'];\n var tags = Object.keys(tagDefinitions);\n\n var validConfigValues = tags\n .map(function(k) { return typeof tagDefinitions[k]; })\n .every(function(type) { return type === 'object' || type === 'boolean' || type === 'function'; });\n\n if(!validConfigValues) {\n throw new Error(\"The configuration was invalid\");\n }\n\n this.config = config;\n }\n\n // TODO: not exhaustive?\n var blockElementNames = ['P', 'LI', 'TD', 'TH', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'PRE'];\n function isBlockElement(node) {\n return blockElementNames.indexOf(node.nodeName) !== -1;\n }\n\n var inlineElementNames = ['A', 'B', 'STRONG', 'I', 'EM', 'SUB', 'SUP', 'U', 'STRIKE'];\n function isInlineElement(node) {\n return inlineElementNames.indexOf(node.nodeName) !== -1;\n }\n\n HTMLJanitor.prototype.clean = function (html) {\n var sandbox = document.createElement('div');\n sandbox.innerHTML = html;\n\n this._sanitize(sandbox);\n\n return sandbox.innerHTML;\n };\n\n HTMLJanitor.prototype._sanitize = function (parentNode) {\n var treeWalker = createTreeWalker(parentNode);\n var node = treeWalker.firstChild();\n if (!node) { return; }\n\n do {\n // Ignore nodes that have already been sanitized\n if (node._sanitized) {\n continue;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n // If this text node is just whitespace and the previous or next element\n // sibling is a block element, remove it\n // N.B.: This heuristic could change. Very specific to a bug with\n // `contenteditable` in Firefox: http://jsbin.com/EyuKase/1/edit?js,output\n // FIXME: make this an option?\n if (node.data.trim() === ''\n && ((node.previousElementSibling && isBlockElement(node.previousElementSibling))\n || (node.nextElementSibling && isBlockElement(node.nextElementSibling)))) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n } else {\n continue;\n }\n }\n\n // Remove all comments\n if (node.nodeType === Node.COMMENT_NODE) {\n parentNode.removeChild(node);\n this._sanitize(parentNode);\n break;\n }\n\n var isInline = isInlineElement(node);\n var containsBlockElement;\n if (isInline) {\n containsBlockElement = Array.prototype.some.call(node.childNodes, isBlockElement);\n }\n\n // Block elements should not be nested (e.g.
  • ...); if\n // they are, we want to unwrap the inner block element.\n var isNotTopContainer = !! parentNode.parentNode;\n var isNestedBlockElement =\n isBlockElement(parentNode) &&\n isBlockElement(node) &&\n isNotTopContainer;\n\n var nodeName = node.nodeName.toLowerCase();\n\n var allowedAttrs = getAllowedAttrs(this.config, nodeName, node);\n\n var isInvalid = isInline && containsBlockElement;\n\n // Drop tag entirely according to the whitelist *and* if the markup\n // is invalid.\n if (isInvalid || shouldRejectNode(node, allowedAttrs)\n || (!this.config.keepNestedBlockElements && isNestedBlockElement)) {\n // Do not keep the inner text of SCRIPT/STYLE elements.\n if (! (node.nodeName === 'SCRIPT' || node.nodeName === 'STYLE')) {\n while (node.childNodes.length > 0) {\n parentNode.insertBefore(node.childNodes[0], node);\n }\n }\n parentNode.removeChild(node);\n\n this._sanitize(parentNode);\n break;\n }\n\n // Sanitize attributes\n for (var a = 0; a < node.attributes.length; a += 1) {\n var attr = node.attributes[a];\n\n if (shouldRejectAttr(attr, allowedAttrs, node)) {\n node.removeAttribute(attr.name);\n // Shift the array to continue looping.\n a = a - 1;\n }\n }\n\n // Sanitize children\n this._sanitize(node);\n\n // Mark node as sanitized so it's ignored in future runs\n node._sanitized = true;\n } while ((node = treeWalker.nextSibling()));\n };\n\n function createTreeWalker(node) {\n return document.createTreeWalker(node,\n NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT,\n null, false);\n }\n\n function getAllowedAttrs(config, nodeName, node){\n if (typeof config.tags[nodeName] === 'function') {\n return config.tags[nodeName](node);\n } else {\n return config.tags[nodeName];\n }\n }\n\n function shouldRejectNode(node, allowedAttrs){\n if (typeof allowedAttrs === 'undefined') {\n return true;\n } else if (typeof allowedAttrs === 'boolean') {\n return !allowedAttrs;\n }\n\n return false;\n }\n\n function shouldRejectAttr(attr, allowedAttrs, node){\n var attrName = attr.name.toLowerCase();\n\n if (allowedAttrs === true){\n return false;\n } else if (typeof allowedAttrs[attrName] === 'function'){\n return !allowedAttrs[attrName](attr.value, node);\n } else if (typeof allowedAttrs[attrName] === 'undefined'){\n return true;\n } else if (allowedAttrs[attrName] === false) {\n return true;\n } else if (typeof allowedAttrs[attrName] === 'string') {\n return (allowedAttrs[attrName] !== attr.value);\n }\n\n return false;\n }\n\n return HTMLJanitor;\n\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/html-janitor/src/html-janitor.js\n// module id = 15\n// module chunks = 0","/**\n * Codex Editor Saver\n *\n * @module Saver\n * @author Codex Team\n * @version 2.0.0\n */\n\n/**\n * @typedef {Object} SavedData\n * @property {Date} time - saving proccess time\n * @property {Object} items - extracted data\n * @property {String} version - CodexEditor version\n */\n\n/**\n * @classdesc This method reduces all Blocks asyncronically and calls Block's save method to extract data\n *\n * @typedef {Saver} Saver\n * @property {Element} html - Editor HTML content\n * @property {String} json - Editor JSON output\n */\n\nexport default class Saver extends Module {\n\n /**\n * @constructor\n * @param config\n */\n constructor({config}) {\n\n super({config});\n\n this.output = null;\n this.blocksData = [];\n\n }\n\n /**\n * Composes new chain of Promises to fire them alternatelly\n * @return {SavedData}\n */\n save() {\n\n let blocks = this.Editor.BlockManager.blocks,\n chainData = [];\n\n blocks.forEach((block) => {\n\n chainData.push(block.data);\n\n });\n\n return Promise.all(chainData)\n .then((allExtractedData) => this.makeOutput(allExtractedData))\n .then((outputData) => {\n\n return outputData;\n\n });\n\n }\n\n /**\n * Creates output object with saved data, time and version of editor\n * @param {Object} allExtractedData\n * @return {SavedData}\n */\n makeOutput(allExtractedData) {\n\n let items = [],\n totalTime = 0;\n\n console.groupCollapsed('[CodexEditor saving]:');\n\n allExtractedData.forEach((extraction, index) => {\n\n /** Group process info */\n console.log(`«${extraction.tool}» saving info`, extraction);\n totalTime += extraction.time;\n items.push(extraction.data);\n\n });\n\n console.log('Total', totalTime);\n console.groupEnd();\n\n return {\n time : +new Date(),\n items : items,\n version : VERSION,\n };\n\n }\n\n}\n\n// module.exports = (function (saver) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * @public\n// * Save blocks\n// */\n// saver.save = function () {\n//\n// /** Save html content of redactor to memory */\n// editor.state.html = editor.nodes.redactor.innerHTML;\n//\n// /** Clean jsonOutput state */\n// editor.state.jsonOutput = [];\n//\n// return saveBlocks(editor.nodes.redactor.childNodes);\n//\n// };\n//\n// /**\n// * @private\n// * Save each block data\n// *\n// * @param blocks\n// * @returns {Promise.}\n// */\n// let saveBlocks = function (blocks) {\n//\n// let data = [];\n//\n// for(let index = 0; index < blocks.length; index++) {\n//\n// data.push(getBlockData(blocks[index]));\n//\n// }\n//\n// return Promise.all(data)\n// .then(makeOutput)\n// .catch(editor.core.log);\n//\n// };\n//\n// /** Save and validate block data */\n// let getBlockData = function (block) {\n//\n// return saveBlockData(block)\n// .then(validateBlockData)\n// .catch(editor.core.log);\n//\n// };\n//\n// /**\n// * @private\n// * Call block`s plugin save method and return saved data\n// *\n// * @param block\n// * @returns {Object}\n// */\n// let saveBlockData = function (block) {\n//\n// let pluginName = block.dataset.tool;\n//\n// /** Check for plugin existence */\n// if (!editor.tools[pluginName]) {\n//\n// editor.core.log(`Plugin «${pluginName}» not found`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Check for plugin having save method */\n// if (typeof editor.tools[pluginName].save !== 'function') {\n//\n// editor.core.log(`Plugin «${pluginName}» must have save method`, 'error');\n// return {data: null, pluginName: null};\n//\n// }\n//\n// /** Result saver */\n// let blockContent = block.childNodes[0],\n// pluginsContent = blockContent.childNodes[0],\n// position = pluginsContent.dataset.inputPosition;\n//\n// /** If plugin wasn't available then return data from cache */\n// if ( editor.tools[pluginName].available === false ) {\n//\n// return Promise.resolve({data: codex.editor.state.blocks.items[position].data, pluginName});\n//\n// }\n//\n// return Promise.resolve(pluginsContent)\n// .then(editor.tools[pluginName].save)\n// .then(data => Object({data, pluginName}));\n//\n// };\n//\n// /**\n// * Call plugin`s validate method. Return false if validation failed\n// *\n// * @param data\n// * @param pluginName\n// * @returns {Object|Boolean}\n// */\n// let validateBlockData = function ({data, pluginName}) {\n//\n// if (!data || !pluginName) {\n//\n// return false;\n//\n// }\n//\n// if (editor.tools[pluginName].validate) {\n//\n// let result = editor.tools[pluginName].validate(data);\n//\n// /**\n// * Do not allow invalid data\n// */\n// if (!result) {\n//\n// return false;\n//\n// }\n//\n// }\n//\n// return {data, pluginName};\n//\n//\n// };\n//\n// /**\n// * Compile article output\n// *\n// * @param savedData\n// * @returns {{time: number, version, items: (*|Array)}}\n// */\n// let makeOutput = function (savedData) {\n//\n// savedData = savedData.filter(blockData => blockData);\n//\n// let items = savedData.map(blockData => Object({type: blockData.pluginName, data: blockData.data}));\n//\n// editor.state.jsonOutput = items;\n//\n// return {\n// id: editor.state.blocks.id || null,\n// time: +new Date(),\n// version: editor.version,\n// items\n// };\n//\n// };\n//\n// return saver;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/saver.js","/**\n * Block Settings\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n */\nexport default class BlockSettings extends Module {\n\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper: null,\n toolSettings: null,\n defaultSettings: null,\n buttonRemove: null\n };\n\n }\n\n /**\n * Block Settings CSS\n * @return {{wrapper, wrapperOpened, toolSettings, defaultSettings, button}}\n */\n static get CSS() {\n\n return {\n // Settings Panel\n wrapper: 'ce-settings',\n wrapperOpened: 'ce-settings--opened',\n toolSettings: 'ce-settings__plugin-zone',\n defaultSettings: 'ce-settings__default-zone',\n\n button: 'ce-settings__button'\n };\n\n }\n\n /**\n * Panel with block settings with 2 sections:\n * - Tool's Settings\n * - Default Settings [Move, Remove, etc]\n *\n * @return {Element}\n */\n make() {\n\n this.nodes.wrapper = $.make('div', BlockSettings.CSS.wrapper);\n\n this.nodes.toolSettings = $.make('div', BlockSettings.CSS.toolSettings);\n this.nodes.defaultSettings = $.make('div', BlockSettings.CSS.defaultSettings);\n\n $.append(this.nodes.wrapper, [this.nodes.toolSettings, this.nodes.defaultSettings]);\n\n /**\n * Add default settings that presents for all Blocks\n */\n this.addDefaultSettings();\n\n }\n\n /**\n * Add Tool's settings\n */\n addToolSettings() {\n\n console.log('Block Settings: add settings for ',\n this.Editor.BlockManager.currentBlock\n );\n\n\n }\n\n /**\n * Add default settings\n */\n addDefaultSettings() {\n\n /**\n * Remove Block Button\n * --------------------------------------------\n */\n this.nodes.buttonRemove = $.make('div', BlockSettings.CSS.button, {\n textContent: 'Remove Block'\n });\n\n $.append(this.nodes.defaultSettings, this.nodes.buttonRemove);\n\n this.Editor.Listeners.on(this.nodes.buttonRemove, 'click', (event) => this.removeBlockButtonClicked(event));\n\n }\n\n /**\n * Clicks on the Remove Block Button\n */\n removeBlockButtonClicked() {\n\n console.log('❇️ Remove Block Button clicked');\n\n }\n\n /**\n * Is Block Settings opened or not\n * @returns {boolean}\n */\n get opened() {\n\n return this.nodes.wrapper.classList.contains(BlockSettings.CSS.wrapperOpened);\n\n }\n\n /**\n * Open Block Settings pane\n */\n open() {\n\n this.nodes.wrapper.classList.add(BlockSettings.CSS.wrapperOpened);\n\n /**\n * Fill Tool's settings\n */\n this.addToolSettings();\n\n }\n\n /**\n * Close Block Settings pane\n */\n close() {\n\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-blockSettings.js","/**\n * @class Toolbox\n * @classdesc Holder for Tools\n *\n * @typedef {Toolbox} Toolbox\n * @property {Boolean} opened - opening state\n * @property {Object} nodes - Toolbox nodes\n * @property {Object} CSS - CSS class names\n *\n */\nexport default class Toolbox extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n toolbox: null,\n buttons: []\n };\n\n /**\n * Opening state\n * @type {boolean}\n */\n this.opened = false;\n\n }\n\n /**\n * CSS styles\n * @return {{toolbox: string, toolboxButton: string, toolboxOpened: string}}\n */\n static get CSS() {\n\n return {\n toolbox: 'ce-toolbox',\n toolboxButton: 'ce-toolbox__button',\n toolboxOpened: 'ce-toolbox--opened',\n };\n\n }\n\n /**\n * Makes the Toolbox\n */\n make() {\n\n this.nodes.toolbox = $.make('div', Toolbox.CSS.toolbox);\n $.append(this.Editor.Toolbar.nodes.content, this.nodes.toolbox);\n\n this.addTools();\n\n }\n\n /**\n * Iterates available tools and appends them to the Toolbox\n */\n addTools() {\n\n let tools = this.Editor.Tools.toolsAvailable;\n\n for (let toolName in tools) {\n\n this.addTool(toolName, tools[toolName]);\n\n }\n\n }\n\n /**\n * Append Tool to the Toolbox\n *\n * @param {string} toolName - tool name\n * @param {Tool} tool - tool class\n */\n addTool(toolName, tool) {\n\n if (tool.displayInToolbox && !tool.iconClassName) {\n\n _.log('Toolbar icon class name is missed. Tool %o skipped', 'warn', toolName);\n return;\n\n }\n\n /**\n * @todo Add checkup for the render method\n */\n // if (typeof tool.render !== 'function') {\n //\n // _.log('render method missed. Tool %o skipped', 'warn', tool);\n // return;\n //\n // }\n\n /**\n * Skip tools that pass 'displayInToolbox=false'\n */\n if (!tool.displayInToolbox) {\n\n return;\n\n }\n\n let button = $.make('li', [Toolbox.CSS.toolboxButton, tool.iconClassName], {\n title: toolName\n });\n\n /**\n * Save tool's name in the button data-name\n */\n button.dataset.name = toolName;\n\n $.append(this.nodes.toolbox, button);\n\n this.nodes.toolbox.appendChild(button);\n this.nodes.buttons.push(button);\n\n /**\n * @todo add event with module Listeners\n */\n // this.Editor.Listeners.add();\n button.addEventListener('click', event => {\n\n this.buttonClicked(event);\n\n }, false);\n\n }\n\n /**\n * Toolbox button click listener\n * 1) if block is empty -> replace\n * 2) if block is not empty -> add new block below\n *\n * @param {MouseEvent} event\n */\n buttonClicked(event) {\n\n let toolButton = event.target,\n toolName = toolButton.dataset.name,\n tool = this.Editor.Tools.toolClasses[toolName];\n\n /**\n * @type {Block}\n */\n let currentBlock = this.Editor.BlockManager.currentBlock;\n\n /**\n * We do replace if:\n * - block is empty\n * - block is not irreplaceable\n * @type {Array}\n */\n if (!tool.irreplaceable && currentBlock.isEmpty) {\n\n this.Editor.BlockManager.replace(toolName);\n\n } else {\n\n this.Editor.BlockManager.insert(toolName);\n\n }\n\n /**\n * @todo set caret to the new block\n */\n\n // window.setTimeout(function () {\n\n /** Set caret to current block */\n // editor.caret.setToBlock(currentInputIndex);\n\n // }, 10);\n\n /**\n * Move toolbar when node is changed\n */\n this.Editor.Toolbar.move();\n\n }\n\n /**\n * Open Toolbox with Tools\n */\n open() {\n\n this.nodes.toolbox.classList.add(Toolbox.CSS.toolboxOpened);\n this.opened = true;\n\n }\n\n /**\n * Close Toolbox\n */\n close() {\n\n this.nodes.toolbox.classList.remove(Toolbox.CSS.toolboxOpened);\n this.opened = false;\n\n }\n\n /**\n * Close Toolbox\n */\n toggle() {\n\n if (!this.opened) {\n\n this.open();\n\n } else {\n\n this.close();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar-toolbox.js","/**\n *\n * «Toolbar» is the node that moves up/down over current block\n *\n * ______________________________________ Toolbar ____________________________________________\n * | |\n * | ..................... Content .................... ......... Block Actions .......... |\n * | . . . . |\n * | . . . [Open Settings] [Remove Block] . |\n * | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |\n * | . . . [Settings Panel] . |\n * | .................................................. .................................. |\n * | |\n * |___________________________________________________________________________________________|\n *\n *\n * Toolbox — its an Element contains tools buttons. Can be shown by Plus Button.\n *\n * _______________ Toolbox _______________\n * | |\n * | [Header] [Image] [List] [Quote] ... |\n * |_______________________________________|\n *\n *\n * Settings Panel — is an Element with block settings:\n *\n * ____ Settings Panel ____\n * | ...................... |\n * | . Tool Settings . |\n * | ...................... |\n * | . Default Settings . |\n * | ...................... |\n * |________________________|\n *\n *\n * @class\n * @classdesc Toolbar module\n *\n * @typedef {Toolbar} Toolbar\n * @property {Object} nodes\n * @property {Element} nodes.wrapper - Toolbar main element\n * @property {Element} nodes.content - Zone with Plus button and toolbox.\n * @property {Element} nodes.actions - Zone with Block Settings and Remove Button\n * @property {Element} nodes.blockActionsButtons - Zone with Block Buttons: [Settings]\n * @property {Element} nodes.plusButton - Button that opens or closes Toolbox\n * @property {Element} nodes.toolbox - Container for tools\n * @property {Element} nodes.settingsToggler - open/close Settings Panel button\n * @property {Element} nodes.settings - Settings Panel\n * @property {Element} nodes.pluginSettings - Plugin Settings section of Settings Panel\n * @property {Element} nodes.defaultSettings - Default Settings section of Settings Panel\n */\nexport default class Toolbar extends Module {\n\n /**\n * @constructor\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n wrapper : null,\n content : null,\n actions : null,\n\n // Content Zone\n plusButton : null,\n\n // Actions Zone\n blockActionsButtons: null,\n settingsToggler : null,\n };\n\n }\n\n /**\n * CSS styles\n * @return {Object}\n * @constructor\n */\n static get CSS() {\n\n return {\n toolbar: 'ce-toolbar',\n content: 'ce-toolbar__content',\n actions: 'ce-toolbar__actions',\n\n toolbarOpened: 'ce-toolbar--opened',\n\n // Content Zone\n plusButton: 'ce-toolbar__plus',\n plusButtonHidden: 'ce-toolbar__plus--hidden',\n\n // Actions Zone\n blockActionsButtons: 'ce-toolbar__actions-buttons',\n settingsToggler: 'ce-toolbar__settings-btn',\n };\n\n }\n\n /**\n * Makes toolbar\n */\n make() {\n\n this.nodes.wrapper = $.make('div', Toolbar.CSS.toolbar);\n\n /**\n * Make Content Zone and Actions Zone\n */\n ['content', 'actions'].forEach( el => {\n\n this.nodes[el] = $.make('div', Toolbar.CSS[el]);\n $.append(this.nodes.wrapper, this.nodes[el]);\n\n });\n\n\n /**\n * Fill Content Zone:\n * - Plus Button\n * - Toolbox\n */\n this.nodes.plusButton = $.make('div', Toolbar.CSS.plusButton);\n $.append(this.nodes.content, this.nodes.plusButton);\n this.nodes.plusButton.addEventListener('click', event => this.plusButtonClicked(event), false);\n\n\n /**\n * Make a Toolbox\n */\n this.Editor.Toolbox.make();\n\n /**\n * Fill Actions Zone:\n * - Settings Toggler\n * - Remove Block Button\n * - Settings Panel\n */\n this.nodes.blockActionsButtons = $.make('div', Toolbar.CSS.blockActionsButtons);\n this.nodes.settingsToggler = $.make('span', Toolbar.CSS.settingsToggler);\n\n $.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);\n $.append(this.nodes.actions, this.nodes.blockActionsButtons);\n\n /**\n * Make and append Settings Panel\n */\n this.Editor.BlockSettings.make();\n $.append(this.nodes.actions, this.Editor.BlockSettings.nodes.wrapper);\n\n /**\n * Append toolbar to the Editor\n */\n $.append(this.Editor.UI.nodes.wrapper, this.nodes.wrapper);\n\n /**\n * Bind events on the Toolbar elements\n */\n this.bindEvents();\n\n }\n\n /**\n * Move Toolbar to the Current Block\n */\n move() {\n\n /** Close Toolbox when we move toolbar */\n this.Editor.Toolbox.close();\n\n let currentNode = this.Editor.BlockManager.currentNode;\n\n /**\n * If no one Block selected as a Current\n */\n if (!currentNode) {\n\n return;\n\n }\n\n /**\n * @todo Compute dynamically on prepare\n * @type {number}\n */\n const defaultToolbarHeight = 49;\n const defaultOffset = 34;\n\n var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;\n\n this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;\n\n /** Close trash actions */\n // editor.toolbar.settings.hideRemoveActions();\n\n }\n\n /**\n * Open Toolbar with Plus Button\n */\n open() {\n\n this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Close the Toolbar\n */\n close() {\n\n this.nodes.wrapper.classList.remove(Toolbar.CSS.toolbarOpened);\n\n }\n\n /**\n * Plus Button public methods\n * @return {{hide: function(): void, show: function(): void}}\n */\n get plusButton() {\n\n return {\n hide: () => this.nodes.plusButton.classList.add(Toolbar.CSS.plusButtonHidden),\n show: () => this.nodes.plusButton.classList.remove(Toolbar.CSS.plusButtonHidden)\n };\n\n }\n\n /**\n * Handler for Plus Button\n * @param {MouseEvent} event\n */\n plusButtonClicked() {\n\n this.Editor.Toolbox.toggle();\n\n }\n\n /**\n * Bind events on the Toolbar Elements:\n * - Block Settings\n */\n bindEvents() {\n\n /**\n * Settings toggler\n */\n this.Editor.Listeners.on(this.nodes.settingsToggler, 'click', (event) => {\n\n this.settingsTogglerClicked(event);\n\n });\n\n }\n\n /**\n * Clicks on the Block Settings toggler\n */\n settingsTogglerClicked() {\n\n if (this.Editor.BlockSettings.opened) {\n\n this.Editor.BlockSettings.close();\n\n } else {\n\n this.Editor.BlockSettings.open();\n\n }\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/toolbar.js","/**\n * @module Codex Editor Tools Submodule\n *\n * Creates Instances from Plugins and binds external config to the instances\n */\n\n/**\n * Each Tool must contain the following important objects:\n *\n * @typedef {Object} ToolConfig {@link docs/tools.md}\n * @property {String} iconClassname - this a icon in toolbar\n * @property {Boolean} displayInToolbox - will be displayed in toolbox. Default value is TRUE\n * @property {Boolean} enableLineBreaks - inserts new block or break lines. Default value is FALSE\n * @property render @todo add description\n * @property save @todo add description\n * @property settings @todo add description\n * @property validate - method that validates output data before saving\n */\n\n/**\n * @typedef {Function} Tool {@link docs/tools.md}\n * @property {Boolean} displayInToolbox - By default, tools won't be added in the Toolbox. Pass true to add.\n * @property {String} iconClassName - CSS class name for the Toolbox button\n * @property {Boolean} irreplaceable - Toolbox behaviour: replace or add new block below\n * @property render\n * @property save\n * @property settings\n * @property validate\n *\n * @todo update according to current API\n * @todo describe Tool in the {@link docs/tools.md}\n */\n\n/**\n * Class properties:\n *\n * @typedef {Tools} Tools\n * @property {Tools[]} toolsAvailable - available Tools\n * @property {Tools[]} toolsUnavailable - unavailable Tools\n * @property {Object} toolsClasses - all classes\n * @property {EditorConfig} config - Editor config\n */\nexport default class Tools extends Module {\n\n /**\n * Returns available Tools\n * @return {Tool[]}\n */\n get available() {\n\n return this.toolsAvailable;\n\n }\n\n /**\n * Returns unavailable Tools\n * @return {Tool[]}\n */\n get unavailable() {\n\n return this.toolsUnavailable;\n\n }\n\n /**\n * Static getter for default Tool config fields\n *\n * @usage Tools.defaultConfig.displayInToolbox\n * @return {ToolConfig}\n */\n static get defaultConfig() {\n\n return {\n iconClassName : '',\n displayInToolbox : false,\n enableLineBreaks : false,\n irreplaceable : false\n };\n\n }\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n /**\n * Map {name: Class, ...} where:\n * name — block type name in JSON. Got from EditorConfig.tools keys\n * @type {Object}\n */\n this.toolClasses = {};\n\n /**\n * Available tools list\n * {name: Class, ...}\n * @type {Object}\n */\n this.toolsAvailable = {};\n\n /**\n * Tools that rejected a prepare method\n * {name: Class, ... }\n * @type {Object}\n */\n this.toolsUnavailable = {};\n\n }\n\n /**\n * Creates instances via passed or default configuration\n * @return {Promise}\n */\n prepare() {\n\n if (!this.config.hasOwnProperty('tools')) {\n\n return Promise.reject(\"Can't start without tools\");\n\n }\n\n for(let toolName in this.config.tools) {\n\n this.toolClasses[toolName] = this.config.tools[toolName];\n\n }\n\n /**\n * getting classes that has prepare method\n */\n let sequenceData = this.getListOfPrepareFunctions();\n\n /**\n * if sequence data contains nothing then resolve current chain and run other module prepare\n */\n if (sequenceData.length === 0) {\n\n return Promise.resolve();\n\n }\n\n /**\n * to see how it works {@link Util#sequence}\n */\n return _.sequence(sequenceData, (data) => {\n\n this.success(data);\n\n }, (data) => {\n\n this.fallback(data);\n\n });\n\n }\n\n /**\n * Binds prepare function of plugins with user or default config\n * @return {Array} list of functions that needs to be fired sequentially\n */\n getListOfPrepareFunctions() {\n\n let toolPreparationList = [];\n\n for(let toolName in this.toolClasses) {\n\n let toolClass = this.toolClasses[toolName];\n\n if (typeof toolClass.prepare === 'function') {\n\n toolPreparationList.push({\n function : toolClass.prepare,\n data : {\n toolName\n }\n });\n\n } else {\n\n /**\n * If Tool hasn't a prepare method, mark it as available\n */\n this.toolsAvailable[toolName] = toolClass;\n\n }\n\n }\n\n return toolPreparationList;\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to available list\n */\n success(data) {\n\n this.toolsAvailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * @param {ChainData.data} data - append tool to unavailable list\n */\n fallback(data) {\n\n this.toolsUnavailable[data.toolName] = this.toolClasses[data.toolName];\n\n }\n\n /**\n * Return tool`a instance\n *\n * @param {String} tool — tool name\n * @param {Object} data — initial data\n *\n * @todo throw exceptions if tool doesnt exist\n *\n */\n construct(tool, data) {\n\n let plugin = this.toolClasses[tool],\n config = this.config.toolsConfig[tool];\n\n if (!config) {\n\n config = this.defaultConfig;\n\n }\n\n let instance = new plugin(data, config);\n\n return instance;\n\n }\n\n /**\n * Check if passed Tool is an instance of Initial Block Tool\n * @param {Tool} tool - Tool to check\n * @return {Boolean}\n */\n isInitial(tool) {\n\n return tool instanceof this.available[this.config.initialBlock];\n\n }\n\n}\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/tools.js","/**\n * Module UI\n *\n * @type {UI}\n */\n// let className = {\n\n/**\n * @const {string} BLOCK_CLASSNAME - redactor blocks name\n */\n// BLOCK_CLASSNAME : 'ce-block',\n\n/**\n * @const {String} wrapper for plugins content\n */\n// BLOCK_CONTENT : 'ce-block__content',\n\n/**\n * @const {String} BLOCK_STRETCHED - makes block stretched\n */\n// BLOCK_STRETCHED : 'ce-block--stretched',\n\n/**\n * @const {String} BLOCK_HIGHLIGHTED - adds background\n */\n// BLOCK_HIGHLIGHTED : 'ce-block--focused',\n\n/**\n * @const {String} - for all default settings\n */\n// SETTINGS_ITEM : 'ce-settings__item'\n// };\n\n// import Block from '../block';\n\n/**\n * @class\n *\n * @classdesc Makes CodeX Editor UI:\n * \n * \n * \n * \n * \n *\n * @typedef {UI} UI\n * @property {EditorConfig} config - editor configuration {@link CodexEditor#configuration}\n * @property {Object} Editor - available editor modules {@link CodexEditor#moduleInstances}\n * @property {Object} nodes -\n * @property {Element} nodes.holder - element where we need to append redactor\n * @property {Element} nodes.wrapper - \n * @property {Element} nodes.redactor - \n */\nexport default class UI extends Module {\n\n /**\n * @constructor\n *\n * @param {EditorConfig} config\n */\n constructor({config}) {\n\n super({config});\n\n this.nodes = {\n holder: null,\n wrapper: null,\n redactor: null\n };\n\n }\n\n /**\n * Making main interface\n */\n prepare() {\n\n // this.Editor.Toolbar.make();\n\n return this.make()\n /**\n * Make toolbar\n */\n .then(() => this.Editor.Toolbar.make())\n /**\n * Load and append CSS\n */\n .then(() => this.loadStyles())\n /**\n * Bind events for the UI elements\n */\n .then(() => this.bindEvents())\n\n /** Make container for inline toolbar */\n // .then(makeInlineToolbar_)\n\n /** Add inline toolbar tools */\n // .then(addInlineToolbarTools_)\n\n /** Draw wrapper for notifications */\n // .then(makeNotificationHolder_)\n\n /** Add eventlisteners to redactor elements */\n // .then(bindEvents_)\n\n .catch(e => {\n\n console.error(e);\n\n // editor.core.log(\"Can't draw editor interface\");\n\n });\n\n }\n\n /**\n * CodeX Editor UI CSS class names\n * @return {{editorWrapper: string, editorZone: string, block: string}}\n */\n get CSS() {\n\n return {\n editorWrapper : 'codex-editor',\n editorZone : 'codex-editor__redactor',\n };\n\n }\n\n /**\n * Makes CodeX Editor interface\n * @return {Promise}\n */\n make() {\n\n return new Promise( (resolve, reject) => {\n\n /**\n * Element where we need to append CodeX Editor\n * @type {Element}\n */\n this.nodes.holder = document.getElementById(this.config.holderId);\n\n if (!this.nodes.holder) {\n\n reject(Error(\"Holder wasn't found by ID: #\" + this.config.holderId));\n return;\n\n }\n\n /**\n * Create and save main UI elements\n */\n this.nodes.wrapper = $.make('div', this.CSS.editorWrapper);\n this.nodes.redactor = $.make('div', this.CSS.editorZone);\n\n this.nodes.wrapper.appendChild(this.nodes.redactor);\n this.nodes.holder.appendChild(this.nodes.wrapper);\n\n resolve();\n\n });\n\n }\n\n /**\n * Appends CSS\n */\n loadStyles() {\n\n /**\n * Load CSS\n */\n let styles = require('../../styles/main.css');\n\n /**\n * Make tag\n */\n let tag = $.make('style', null, {\n textContent: styles.toString()\n });\n\n /**\n * Append styles\n */\n $.append(document.head, tag);\n\n }\n\n /**\n * Bind events on the CodeX Editor interface\n */\n bindEvents() {\n\n /**\n * @todo bind events with the Listeners module\n */\n this.Editor.Listeners.on(this.nodes.redactor, 'click', event => this.redactorClicked(event), false );\n\n }\n\n /**\n * All clicks on the redactor zone\n *\n * @param {MouseEvent} event\n *\n * @description\n * 1. Save clicked Block as a current {@link BlockManager#currentNode}\n * it uses for the following:\n * - add CSS modifier for the selected Block\n * - on Enter press, we make a new Block under that\n *\n * 2. Move and show the Toolbar\n *\n * 3. Set a Caret\n *\n * 4. By clicks on the Editor's bottom zone:\n * - if last Block is empty, set a Caret to this\n * - otherwise, add a new empty Block and set a Caret to that\n *\n * 5. Hide the Inline Toolbar\n *\n * @see selectClickedBlock\n *\n */\n redactorClicked(event) {\n\n let clickedNode = event.target;\n\n /**\n * Select clicked Block as Current\n */\n try {\n\n this.Editor.BlockManager.setCurrentBlockByChildNode(clickedNode);\n\n } catch (e) {\n\n /**\n * If clicked outside first-level Blocks, set Caret to the last empty Block\n */\n this.Editor.Caret.setToTheLastBlock();\n\n }\n\n\n /**\n * @todo hide the Inline Toolbar\n */\n // var selectedText = editor.toolbar.inline.getSelectionText(),\n // firstLevelBlock;\n\n /** If selection range took off, then we hide inline toolbar */\n // if (selectedText.length === 0) {\n\n // editor.toolbar.inline.close();\n\n // }\n\n /**\n *\n\n /** Update current input index in memory when caret focused into existed input */\n // if (event.target.contentEditable == 'true') {\n //\n // editor.caret.saveCurrentInputIndex();\n //\n // }\n\n // if (editor.content.currentNode === null) {\n //\n // /**\n // * If inputs in redactor does not exits, then we put input index 0 not -1\n // */\n // var indexOfLastInput = editor.state.inputs.length > 0 ? editor.state.inputs.length - 1 : 0;\n //\n // /** If we have any inputs */\n // if (editor.state.inputs.length) {\n //\n // /** getting firstlevel parent of input */\n // firstLevelBlock = editor.content.getFirstLevelBlock(editor.state.inputs[indexOfLastInput]);\n //\n // }\n //\n // /** If input is empty, then we set caret to the last input */\n // if (editor.state.inputs.length && editor.state.inputs[indexOfLastInput].textContent === '' && firstLevelBlock.dataset.tool == editor.settings.initialBlockPlugin) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Create new input when caret clicked in redactors area */\n // var NEW_BLOCK_TYPE = editor.settings.initialBlockPlugin;\n //\n // editor.content.insertBlock({\n // type : NEW_BLOCK_TYPE,\n // block : editor.tools[NEW_BLOCK_TYPE].render()\n // });\n //\n // /** If there is no inputs except inserted */\n // if (editor.state.inputs.length === 1) {\n //\n // editor.caret.setToBlock(indexOfLastInput);\n //\n // } else {\n //\n // /** Set caret to this appended input */\n // editor.caret.setToNextBlock(indexOfLastInput);\n //\n // }\n //\n // }\n //\n // } else {\n //\n // /** Close all panels */\n // editor.toolbar.settings.close();\n // editor.toolbar.toolbox.close();\n //\n // }\n //\n /**\n * Move toolbar and open\n */\n this.Editor.Toolbar.move();\n this.Editor.Toolbar.open();\n //\n // var inputIsEmpty = !editor.content.currentNode.textContent.trim(),\n // currentNodeType = editor.content.currentNode.dataset.tool,\n // isInitialType = currentNodeType == editor.settings.initialBlockPlugin;\n //\n //\n\n /**\n * Hide the Plus Button\n * */\n this.Editor.Toolbar.plusButton.hide();\n\n /**\n * Show the Plus Button if:\n * - Block is an initial-block (Text)\n * - Block is empty\n */\n let isInitialBlock = this.Editor.Tools.isInitial(this.Editor.BlockManager.currentBlock.tool),\n isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;\n\n if (isInitialBlock && isEmptyBlock) {\n\n this.Editor.Toolbar.plusButton.show();\n\n }\n\n }\n\n}\n\n// /**\n// * Codex Editor UI module\n// *\n// * @author Codex Team\n// * @version 1.2.0\n// */\n//\n// module.exports = (function (ui) {\n//\n// let editor = codex.editor;\n//\n// /**\n// * Basic editor classnames\n// */\n// ui.prepare = function () {\n//\n\n//\n// };\n//\n// /** Draw notifications holder */\n// var makeNotificationHolder_ = function () {\n//\n// /** Append block with notifications to the document */\n// editor.nodes.notifications = editor.notifications.createHolder();\n//\n// };\n//\n//\n// var addInlineToolbarTools_ = function () {\n//\n// var tools = {\n//\n// bold: {\n// icon : 'ce-icon-bold',\n// command : 'bold'\n// },\n//\n// italic: {\n// icon : 'ce-icon-italic',\n// command : 'italic'\n// },\n//\n// link: {\n// icon : 'ce-icon-link',\n// command : 'createLink'\n// }\n// };\n//\n// var toolButton,\n// tool;\n//\n// for(var name in tools) {\n//\n// tool = tools[name];\n//\n// toolButton = editor.draw.toolbarButtonInline(name, tool.icon);\n//\n// editor.nodes.inlineToolbar.buttons.appendChild(toolButton);\n// /**\n// * Add callbacks to this buttons\n// */\n// editor.ui.setInlineToolbarButtonBehaviour(toolButton, tool.command);\n//\n// }\n//\n// };\n//\n// /**\n// * @private\n// * Bind editor UI events\n// */\n// var bindEvents_ = function () {\n//\n// editor.core.log('ui.bindEvents fired', 'info');\n//\n// // window.addEventListener('error', function (errorMsg, url, lineNumber) {\n// // editor.notifications.errorThrown(errorMsg, event);\n// // }, false );\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keydown', editor.callback.globalKeydown, false);\n//\n// /** All keydowns on Redactor zone */\n// editor.listeners.add(editor.nodes.redactor, 'keydown', editor.callback.redactorKeyDown, false);\n//\n// /** All keydowns on Document */\n// editor.listeners.add(document, 'keyup', editor.callback.globalKeyup, false );\n//\n// /**\n// * Mouse click to radactor\n// */\n// editor.listeners.add(editor.nodes.redactor, 'click', editor.callback.redactorClicked, false );\n//\n// /**\n// * Clicks to the Plus button\n// */\n// editor.listeners.add(editor.nodes.plusButton, 'click', editor.callback.plusButtonClicked, false);\n//\n// /**\n// * Clicks to SETTINGS button in toolbar\n// */\n// editor.listeners.add(editor.nodes.showSettingsButton, 'click', editor.callback.showSettingsButtonClicked, false );\n//\n// /** Bind click listeners on toolbar buttons */\n// for (var button in editor.nodes.toolbarButtons) {\n//\n// editor.listeners.add(editor.nodes.toolbarButtons[button], 'click', editor.callback.toolbarButtonClicked, false);\n//\n// }\n//\n// };\n//\n// ui.addBlockHandlers = function (block) {\n//\n// if (!block) return;\n//\n// /**\n// * Block keydowns\n// */\n// editor.listeners.add(block, 'keydown', editor.callback.blockKeydown, false);\n//\n// /**\n// * Pasting content from another source\n// * We have two type of sanitization\n// * First - uses deep-first search algorithm to get sub nodes,\n// * sanitizes whole Block_content and replaces cleared nodes\n// * This method is deprecated\n// * Method is used in editor.callback.blockPaste(event)\n// *\n// * Secont - uses Mutation observer.\n// * Observer \"observe\" DOM changes and send changings to callback.\n// * Callback gets changed node, not whole Block_content.\n// * Inserted or changed node, which we've gotten have been cleared and replaced with diry node\n// *\n// * Method is used in editor.callback.blockPasteViaSanitize(event)\n// *\n// * @uses html-janitor\n// * @example editor.callback.blockPasteViaSanitize(event), the second method.\n// *\n// */\n// editor.listeners.add(block, 'paste', editor.paste.blockPasteCallback, false);\n//\n// /**\n// * Show inline toolbar for selected text\n// */\n// editor.listeners.add(block, 'mouseup', editor.toolbar.inline.show, false);\n// editor.listeners.add(block, 'keyup', editor.toolbar.inline.show, false);\n//\n// };\n//\n// /** getting all contenteditable elements */\n// ui.saveInputs = function () {\n//\n// var redactor = editor.nodes.redactor;\n//\n// editor.state.inputs = [];\n//\n// /** Save all inputs in global variable state */\n// var inputs = redactor.querySelectorAll('[contenteditable], input, textarea');\n//\n// Array.prototype.map.call(inputs, function (current) {\n//\n// if (!current.type || current.type == 'text' || current.type == 'textarea') {\n//\n// editor.state.inputs.push(current);\n//\n// }\n//\n// });\n//\n// };\n//\n// /**\n// * Adds first initial block on empty redactor\n// */\n// ui.addInitialBlock = function () {\n//\n// var initialBlockType = editor.settings.initialBlockPlugin,\n// initialBlock;\n//\n// if ( !editor.tools[initialBlockType] ) {\n//\n// editor.core.log('Plugin %o was not implemented and can\\'t be used as initial block', 'warn', initialBlockType);\n// return;\n//\n// }\n//\n// initialBlock = editor.tools[initialBlockType].render();\n//\n// initialBlock.setAttribute('data-placeholder', editor.settings.placeholder);\n//\n// editor.content.insertBlock({\n// type : initialBlockType,\n// block : initialBlock\n// });\n//\n// editor.content.workingNodeChanged(initialBlock);\n//\n// };\n//\n// ui.setInlineToolbarButtonBehaviour = function (button, type) {\n//\n// editor.listeners.add(button, 'mousedown', function (event) {\n//\n// editor.toolbar.inline.toolClicked(event, type);\n//\n// }, false);\n//\n// };\n//\n// return ui;\n//\n// })({});\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/modules/ui.js","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")(undefined);\n// imports\n\n\n// module\nexports.push([module.id, \":root {\\n\\n /**\\n * Toolbar buttons\\n */\\n\\n /**\\n * All gray texts: placeholders, settings\\n */\\n\\n /**\\n * Block content width\\n */\\n\\n /**\\n * Toolbar Plus Button and Toolbox buttons height and width\\n */\\n\\n}\\n/**\\n* Editor wrapper\\n*/\\n.codex-editor {\\n position: relative;\\n border: 1px solid #ccc;\\n padding: 2px;\\n box-sizing: border-box;\\n}\\n.codex-editor .hide {\\n display: none;\\n }\\n.codex-editor__redactor {\\n padding-bottom: 300px;\\n }\\n.ce-toolbar {\\n position: absolute;\\n left: 0;\\n right: 0;\\n top: 0;\\n /*opacity: 0;*/\\n /*visibility: hidden;*/\\n transition: opacity 100ms ease;\\n will-change: opacity, transform;\\n display: none;\\n}\\n.ce-toolbar--opened {\\n display: block;\\n /*opacity: 1;*/\\n /*visibility: visible;*/\\n }\\n.ce-toolbar__content {\\n max-width: 650px;\\n margin: 0 auto;\\n position: relative;\\n }\\n.ce-toolbar__plus {\\n position: absolute;\\n left: calc(-34px - 10px);\\n display: inline-block;\\n background-color: #eff2f5;\\n width: 34px;\\n height: 34px;\\n line-height: 34px;\\n text-align: center;\\n border-radius: 50%\\n }\\n.ce-toolbar__plus::after {\\n content: '+';\\n font-size: 26px;\\n display: block;\\n margin-top: -2px;\\n margin-right: -2px;\\n\\n}\\n.ce-toolbar__plus--hidden {\\n display: none;\\n\\n}\\n/**\\n * Block actions Zone\\n * -------------------------\\n */\\n.ce-toolbar__actions {\\n position: absolute;\\n right: 0;\\n top: 0;\\n border: 1px dotted #ccc;\\n padding: 2px;\\n }\\n.ce-toolbar__actions-buttons {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n text-align: right;\\n margin-bottom: 2px;\\n }\\n.ce-toolbar__settings-btn {\\n display: inline-block;\\n width: 24px;\\n height: 24px;\\n border: 1px dotted #ccc\\n }\\n.ce-toolbar__settings-btn::before {\\n content: 'STN';\\n font-size: 10px;\\n opacity: .4;\\n\\n}\\n.ce-toolbox {\\n visibility: hidden;\\n transition: opacity 100ms ease;\\n will-change: opacity;\\n}\\n.ce-toolbox--opened {\\n opacity: 1;\\n visibility: visible;\\n }\\n.ce-toolbox__button {\\n display: inline-block;\\n list-style: none;\\n margin: 0;\\n background: #eff2f5;\\n width: 34px;\\n height: 34px;\\n border-radius: 30px;\\n overflow: hidden;\\n text-align: center;\\n line-height: 34px\\n }\\n.ce-toolbox__button::before {\\n content: attr(title);\\n font-size: 22px;\\n font-weight: 500;\\n letter-spacing: 1em;\\n -webkit-font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-feature-settings: \\\"smcp\\\", \\\"c2sc\\\";\\n font-variant-caps: all-small-caps;\\n padding-left: 11.5px;\\n margin-top: -1px;\\n display: inline-block;\\n\\n}\\n.ce-settings {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n display: none;\\n}\\n.ce-settings--opened {\\n display: block;\\n }\\n.ce-settings__plugin-zone {\\n border: 1px dotted #ccc;\\n padding: 2px;\\n margin-bottom: 2px\\n }\\n.ce-settings__plugin-zone::before {\\n content: 'PLUGIN SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__default-zone {\\n border: 1px dotted #ccc;\\n padding: 2px\\n }\\n.ce-settings__default-zone::before {\\n content: 'DEFAULT SETTINGS';\\n opacity: .4;\\n font-size: 12px;\\n\\n}\\n.ce-settings__button {\\n padding: 10px 15px;\\n color: #707684\\n }\\n.ce-settings__button:hover {\\n background: #eff2f5;\\n\\n}\\n.ce-block {\\n border: 1px dotted #ccc;\\n margin: 2px 0\\n}\\n.ce-block:first-of-type {\\n margin-top: 0;\\n\\n}\\n.ce-block--selected {\\n background-color: #eff2f5;\\n\\n}\\n.ce-block__content {\\n max-width: 650px;\\n margin: 0 auto;\\n\\n}\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/styles/main.css\n// module id = 22\n// module chunks = 0","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/css-loader/lib/css-base.js\n// module id = 23\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/src/components/modules/blockManager.js b/src/components/modules/blockManager.js index 309d8eb98..8594ae6db 100644 --- a/src/components/modules/blockManager.js +++ b/src/components/modules/blockManager.js @@ -214,6 +214,7 @@ export default class BlockManager extends Module { .then( () => { this.removeBlock(blockToMergeIndex); + this.currentBlockIndex = this._blocks.indexOf(targetBlock); }); diff --git a/src/components/modules/keyboard.js b/src/components/modules/keyboard.js index d20aa1175..6facd4166 100644 --- a/src/components/modules/keyboard.js +++ b/src/components/modules/keyboard.js @@ -144,9 +144,6 @@ export default class Keyboard extends Module { BM.mergeBlocks(targetBlock, blockToMerge) .then( () => { - // decrease current block index so that to know current actual - BM.currentBlockIndex--; - window.setTimeout( () => { // set caret to the block without offset at the end