PHP Classes

File: dist/summernote-lite.min.js.map

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   WYSIWYG Rich Text Editor with Ajax Gallery PHP MySQL   dist/summernote-lite.min.js.map   Download  
File: dist/summernote-lite.min.js.map
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WYSIWYG Rich Text Editor with Ajax Gallery PHP MySQL
Edit HTML on a Web page, including images
Author: By
Last change:
Date: 1 year ago
Size: 450,293 bytes
 

Contents

Class file image Download
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///external {\"root\":\"jQuery\",\"commonjs2\":\"jquery\",\"commonjs\":\"jquery\",\"amd\":\"jquery\"}","webpack:///./src/js/base/renderer.js","webpack:///(webpack)/buildin/amd-options.js","webpack:///./src/js/base/summernote-en-US.js","webpack:///./src/js/base/core/env.js","webpack:///./src/js/base/core/func.js","webpack:///./src/js/base/core/lists.js","webpack:///./src/js/base/core/dom.js","webpack:///./src/js/base/Context.js","webpack:///./src/js/base/core/range.js","webpack:///./src/js/summernote.js","webpack:///./src/js/base/core/key.js","webpack:///./src/js/base/editing/History.js","webpack:///./src/js/base/editing/Style.js","webpack:///./src/js/base/editing/Bullet.js","webpack:///./src/js/base/editing/Typing.js","webpack:///./src/js/base/editing/Table.js","webpack:///./src/js/base/module/Editor.js","webpack:///./src/js/base/core/async.js","webpack:///./src/js/base/module/Clipboard.js","webpack:///./src/js/base/module/Codeview.js","webpack:///./src/js/base/module/Dropzone.js","webpack:///./src/js/base/module/Statusbar.js","webpack:///./src/js/base/module/Fullscreen.js","webpack:///./src/js/base/module/Handle.js","webpack:///./src/js/base/module/AutoLink.js","webpack:///./src/js/base/module/AutoSync.js","webpack:///./src/js/base/module/AutoReplace.js","webpack:///./src/js/base/module/Placeholder.js","webpack:///./src/js/base/module/Buttons.js","webpack:///./src/js/base/module/Toolbar.js","webpack:///./src/js/base/module/LinkDialog.js","webpack:///./src/js/base/module/LinkPopover.js","webpack:///./src/js/base/module/ImageDialog.js","webpack:///./src/js/base/module/ImagePopover.js","webpack:///./src/js/base/module/TablePopover.js","webpack:///./src/js/base/module/VideoDialog.js","webpack:///./src/js/base/module/HelpDialog.js","webpack:///./src/js/base/module/AirPopover.js","webpack:///./src/js/base/module/HintPopover.js","webpack:///./src/js/base/settings.js","webpack:///./src/js/lite/ui/TooltipUI.js","webpack:///./src/js/lite/ui/DropdownUI.js","webpack:///./src/js/lite/ui/ModalUI.js","webpack:///./src/js/lite/ui.js","webpack:///./src/js/lite/settings.js"],"names":["root","factory","exports","module","require","define","amd","a","i","window","__WEBPACK_EXTERNAL_MODULE__0__","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Renderer","markup","children","options","callback","this","$parent","$node","$","contents","html","className","addClass","data","each","k","v","attr","click","on","$container","find","forEach","child","render","length","append","arguments","Array","isArray","__webpack_amd_options__","summernote","lang","extend","font","bold","italic","underline","clear","height","strikethrough","subscript","superscript","size","sizeunit","image","insert","resizeFull","resizeHalf","resizeQuarter","resizeNone","floatLeft","floatRight","floatNone","shapeRounded","shapeCircle","shapeThumbnail","shapeNone","dragImageHere","dropImage","selectFromFiles","maximumFileSize","maximumFileSizeError","url","remove","original","video","videoLink","providers","link","unlink","edit","textToDisplay","openInNewWindow","useProtocol","table","addRowAbove","addRowBelow","addColLeft","addColRight","delRow","delCol","delTable","hr","style","blockquote","pre","h1","h2","h3","h4","h5","h6","lists","unordered","ordered","help","fullscreen","codeview","paragraph","outdent","indent","left","center","right","justify","color","recent","more","background","foreground","transparent","setTransparent","reset","resetToDefault","cpSelect","shortcut","shortcuts","close","textFormatting","action","paragraphFormatting","documentStyle","extraKeys","history","undo","redo","specialChar","select","output","noSelection","isSupportAmd","genericFontFamilies","validFontName","fontName","inArray","toLowerCase","browserVersion","userAgent","navigator","isMSIE","test","matches","exec","parseFloat","isEdge","hasCodeMirror","CodeMirror","isSupportTouch","MaxTouchPoints","msMaxTouchPoints","inputEventName","isMac","appVersion","indexOf","isFF","isPhantom","isWebkit","isChrome","isSafari","jqueryVersion","fn","jquery","isFontInstalled","testFontName","context","document","createElement","getContext","testSize","originalWidth","measureText","width","isW3CRangeSupport","createRange","idCounter","eq","itemA","itemB","eq2","peq2","propName","ok","fail","self","not","f","apply","and","fA","fB","item","invoke","obj","method","resetUniqueId","uniqueId","prefix","id","rect2bnd","rect","$document","top","scrollTop","scrollLeft","bottom","invertObject","inverted","namespaceToCamel","namespace","split","map","substring","toUpperCase","join","debounce","func","wait","immediate","timeout","args","later","callNow","clearTimeout","setTimeout","isValidUrl","head","array","last","tail","slice","contains","initial","prev","idx","next","pred","len","all","sum","reduce","memo","from","collection","result","isEmpty","clusterBy","aLast","compact","aResult","push","unique","results","NBSP_CHAR","String","fromCharCode","isEditable","node","hasClass","makePredByNodeName","nodeName","isText","nodeType","isVoid","isPara","isPre","isLi","isTable","isData","isInline","isBodyContainer","isList","isHr","isBlockquote","isCell","isAnchor","isBody","blankHTML","env","nodeLength","nodeValue","childNodes","innerHTML","paddingBlankHTML","ancestor","parentNode","listAncestor","ancestors","el","listNext","nodes","nextSibling","insertAfter","preceding","parent","insertBefore","appendChild","appendChildNodes","aChild","isLeftEdgePoint","point","offset","isRightEdgePoint","isEdgePoint","isLeftEdgeOf","position","isRightEdgeOf","previousSibling","hasChildren","prevPoint","isSkipInnerOffset","nextPoint","isSamePoint","pointA","pointB","splitNode","isSkipPaddingBlankHTML","isNotSplitEdgePoint","isDiscardEmptySplits","splitText","childNode","clone","cloneNode","splitTree","isRemoveChild","removeNode","removeChild","isTextarea","stripLinebreaks","val","replace","ZERO_WIDTH_NBSP_CHAR","blank","emptyPara","isControlSizing","isElement","isPurePara","isHeading","isBlock","isBodyInline","isParaInline","isDiv","isBR","isSpan","isB","isU","isS","isI","isImg","deepestChildIsEmpty","firstElementChild","isEmptyAnchor","isClosestSibling","nodeA","nodeB","withClosestSiblings","siblings","isLeftEdgePointOf","isRightEdgePointOf","isVisiblePoint","leftNode","rightNode","prevPointUntil","nextPointUntil","isCharPoint","ch","charAt","isSpacePoint","walkPoint","startPoint","endPoint","handler","singleChildAncestor","lastAncestor","filter","listPrev","listDescendant","descendants","fnWalk","current","commonAncestor","wrap","wrapperName","wrapper","makeOffsetPath","reverse","fromOffsetPath","offsets","splitPoint","splitRoot","container","topAncestor","pivot","createText","text","createTextNode","removeWhile","newNode","cssText","isNewlineOnBlock","match","endSlash","isEndOfInlineContainer","isBlockNode","trim","posFromPlaceholder","placeholder","$placeholder","pos","outerHeight","attachEvents","events","keys","detachEvents","off","isCustomStyleTag","classList","Context","$note","memos","layoutInfo","ui","ui_template","initialize","createLayout","_initialize","hide","_destroy","removeData","removeLayout","disabled","isDisabled","code","dom","disable","now","editor","buttons","plugins","initializeModule","removeModule","removeMemo","triggerEvent","isActivated","undefined","codable","editable","editing","callbacks","trigger","shouldInitialize","ModuleClass","withoutIntialize","destroy","event","createInvokeHandler","preventDefault","$target","target","closest","splits","hasSeparator","moduleName","methodName","textRangeToPoint","textRange","isStart","prevContainer","parentElement","tester","body","createTextRange","moveToElementText","compareEndPoints","textRangeStart","curTextNode","collapse","firstChild","pointTester","duplicate","setEndPoint","textCount","cont","pointToTextRange","info","textRangeInfo","isCollapseToStart","prevTextNodes","collapseToStart","moveStart","type","isExternalAPICalled","hasInitOptions","langInfo","icons","tooltip","note","first","focus","WrappedRange","sc","so","ec","eo","isOnEditable","makeIsOn","isOnList","isOnAnchor","isOnCell","isOnData","w3cRange","setStart","setEnd","Math","min","nativeRng","nativeRange","selection","getSelection","rangeCount","removeAllRanges","addRange","offsetTop","abs","getVisiblePoint","isLeftToRight","block","hasRightNode","hasLeftNode","getEndPoint","isCollapsed","getStartPoint","includeAncestor","fullyContains","leftEdgeNodes","startAncestor","endAncestor","boundaryPoints","getPoints","isSameContainer","rng","emptyParents","normalize","inlineSiblings","concat","para","wrapBodyInlineWithPara","deleteContents","contentsContainer","insertNode","toString","findAfter","isNotTextPoint","regex","index","path","e","paras","getClientRects","wrappedRange","createFromSelection","bodyElement","lastChild","createFromBodyElement","createFromNode","anchorNode","getRangeAt","startContainer","startOffset","endContainer","endOffset","textRangeEnd","isTextNode","createFromNodeBefore","createFromNodeAfter","createFromBookmark","bookmark","createFromParaBookmark","KEY_MAP","isEdit","keyCode","BACKSPACE","TAB","ENTER","SPACE","DELETE","isMove","LEFT","UP","RIGHT","DOWN","isNavigation","HOME","END","PAGEUP","PAGEDOWN","nameFromCode","History","stack","stackOffset","$editable","range","snapshot","recordUndo","applySnapshot","makeSnapshot","historyLimit","shift","Style","$obj","propertyNames","propertyName","css","styleInfo","jQueryCSS","fontSize","parseInt","expandClosestSibling","onlyPartialContains","nodesInRange","tails","elem","$cont","fromNode","queryCommandState","queryCommandValue","isUnordered","lineHeight","toFixed","anchor","Bullet","toggleList","clustereds","previousList","findList","wrapList","appendToPrevious","releaseList","listName","paraBookmark","wrappedParas","diffLists","listNode","prevList","nextList","isEscapseToBody","releasedParas","headList","parentItem","newList","findNextSiblings","lastList","middleList","rootLists","rootList","listNodes","Typing","bullet","tabsize","tab","nextPara","blockquoteBreakingLevel","emptyAnchors","scrollIntoView","TableResultAction","where","domTable","_startPoint","_virtualTable","_actionCellList","setVirtualTablePosition","rowIndex","cellIndex","baseRow","baseCell","isRowSpan","isColSpan","isVirtualCell","objPosition","getActionCell","virtualTableCellObj","resultAction","virtualRowPosition","virtualColPosition","recoverCellIndex","newCellIndex","addCellInfoToVirtual","row","cell","cellHasColspan","colSpan","cellHasRowspan","rowSpan","isThisSelectedCell","rowPos","colPos","rowspanNumber","attributes","rp","rowspanIndex","adjustStartPoint","colspanNumber","cp","cellspanIndex","isSelectedCell","getDeleteResultActionToCell","Column","SubtractSpanCount","Row","isVirtual","AddCell","RemoveCell","getAddResultActionToCell","SumSpanCount","Ignore","getActionList","fixedRow","fixedCol","actualPosition","canContinue","rowPosition","colPosition","requestAction","Add","Delete","tagName","rows","cells","createVirtualTable","Table","isShift","nextCell","currentTr","trAttributes","recoverAttributes","actions","idCell","currentCell","tdAttributes","newTd","removeAttr","setAttribute","before","lastTrIndex","after","actionIndex","resultStr","attrList","specified","cellPos","virtualPosition","virtualTable","hasRowspan","nextRow","cloneRow","removeAttribute","colCount","rowCount","tdHTML","tds","idxCol","trHTML","trs","idxRow","$table","tableClassName","Editor","$editor","lastRange","typing","untab","insertParagraph","insertOrderedList","insertUnorderedList","formatPara","insertHorizontalRule","commands","sCmd","beforeCommand","execCommand","afterCommand","wrapCommand","fontStyling","unit","currentStyle","fontSizeUnit","formatBlock","isLimited","getLastRange","setLastRange","insertText","textNode","pasteHTML","onApplyCustomStyle","onFormatBlock","hrNode","stylePara","createLink","linkInfo","linkUrl","linkText","isNewWindow","checkProtocol","additionalTextLength","isTextChanged","onCreateLink","defaultProtocol","anchors","styleNodes","colorInfo","foreColor","backColor","insertTable","dim","dimension","createTable","removeMedia","restoreTarget","detach","floatMe","toggleClass","resize","hasKeyShortCut","isDefaultPrevented","handleKeyMap","preventDefaultEditableShortCuts","recordEveryKeystroke","spellCheck","disableGrammar","airMode","overrideContextMenu","outerWidth","maxHeight","minHeight","keyMap","metaKey","ctrlKey","altKey","shiftKey","keyName","eventName","tabDisable","pad","maxTextLength","thenCollapse","commit","styleWithCSS","isPreventTrigger","normalizeContent","tabSize","insertTab","src","param","Deferred","deferred","$img","one","resolve","reject","display","appendTo","promise","then","$image","show","files","file","filename","maximumImageFileSize","FileReader","onload","dataURL","onerror","err","readAsDataURL","readFileAsDataURL","insertImage","onImageUpload","insertImagesAsDataURL","currentRange","spans","firstSpan","noteStatusOutput","expand","$anchor","addRow","addCol","deleteRow","deleteCol","deleteTable","bKeepRatio","imageSize","newRatio","y","x","ratio","is","hasFocus","Clipboard","pasteByEvent","clipboardData","originalEvent","items","kind","getAsFile","getData","Dropzone","$eventListener","documentEventHandlers","$dropzone","prependTo","disableDragAndDrop","onDrop","attachDragAndDropEvent","$dropzoneMessage","onDragenter","isCodeview","hasEditorSize","add","onDragleave","removeClass","dataTransfer","types","content","substr","CodeView","$codable","save","deactivate","activate","codeviewFilter","codeviewFilterRegex","codeviewIframeFilter","whitelist","codeviewIframeWhitelistSrc","codeviewIframeWhitelistSrcBase","tag","RegExp","prettifyHtml","cmEditor","fromTextArea","codemirror","tern","server","TernServer","ternServer","cm","updateArgHints","getValue","setSize","toTextArea","purify","isChange","Statusbar","$statusbar","statusbar","disableResizeEditor","stopPropagation","editableTop","onMouseMove","clientY","minheight","max","Fullscreen","$toolbar","toolbar","$window","$scrollbar","onResize","resizeTo","h","setsize","isFullscreen","Handle","$editingArea","editingArea","we","update","$handle","disableResizeImage","posStart","clientX","isImage","$selection","w","origImageObj","Image","sizingText","linkPattern","AutoLink","handleKeyup","handleKeydown","lastWordRange","keyword","urlText","linkTargetBlank","wordRange","getWordRange","AutoSync","AutoReplace","PERIOD","COMMA","SEMICOLON","SLASH","previousKeydownCode","lastWord","jQuery","Node","Placeholder","inheritPlaceholder","isShow","toggle","Buttons","invertedKeyMap","editorMethod","button","addToolbarButtons","addImagePopoverButtons","addLinkPopoverButtons","addTablePopoverButtons","fontInstalledMap","fontNamesIgnoreCheck","buttonGroup","icon","$button","currentTarget","$recentColor","colorButton","dropdownButtonContents","dropdown","$dropdown","$holder","palette","colors","colorsName","customColors","change","$chip","$picker","$palette","prepend","$color","$currentButton","magic","styleTags","title","template","styleIdx","styleLen","representShortcut","createInvokeHandlerAndUpdateState","eraser","addDefaultFonts","fontname","isFontDeservedToAdd","fontNames","dropdownCheck","checkClassName","menuCheck","fontSizes","fontSizeUnits","colorPalette","unorderedlist","orderedlist","justifyLeft","alignLeft","justifyCenter","alignCenter","justifyRight","alignRight","justifyFull","alignJustify","textHeight","lineHeights","insertTableMaxSize","col","mousedown","tableMoveHandler","picture","minus","arrowsAlt","question","rollback","trash","rowAbove","rowBelow","colBefore","colAfter","rowRemove","colRemove","groups","groupIdx","groupLen","group","groupName","$group","btn","updateBtnStates","$item","isChecked","infos","selector","toggleBtnActive","posOffset","$dimensionDisplay","$catcher","$highlighted","$unhighlighted","offsetX","posCatcher","pageX","pageY","offsetY","ceil","Toolbar","isFollowing","followScroll","toolbarContainer","changeContainer","followingToolbar","editorHeight","editorWidth","toolbarHeight","statusbarHeight","otherBarHeight","otherStaticBar","currentOffset","editorOffsetTop","activateOffset","deactivateOffsetBottom","marginTop","zIndex","isIncludeCodeview","$btn","toggleBtn","LinkDialog","$body","dialogsInBody","disableLinkTarget","checkbox","checked","footer","$dialog","dialog","fade","dialogsFade","hideDialog","$input","$linkBtn","$linkText","$linkUrl","$openInNewWindow","$useProtocol","onDialogShown","toggleLinkBtn","bindEnterKey","isNewWindowChecked","prop","useProtocolChecked","onDialogHidden","state","showDialog","showLinkDialog","LinkPopover","popover","$popover","$content","href","containerOffset","ImageDialog","imageLimitation","floor","log","readableSize","pow","showImageDialog","onImageLinkInsert","$imageInput","$imageUrl","$imageBtn","replaceWith","ImagePopover","popatmouse","TablePopover","VideoDialog","$video","ytMatch","igMatch","vMatch","vimMatch","dmMatch","youkuMatch","qqMatch","qqMatch2","mp4Match","oggMatch","webmMatch","fbMatch","youtubeId","start","ytMatchForStart","vid","encodeURIComponent","showVideoDialog","createVideoNode","$videoUrl","$videoBtn","HelpDialog","createShortcutList","command","$row","showHelpDialog","AirPopover","hidable","onContextmenu","air","forcelyOpen","HintPopover","hint","direction","hintDirection","hints","matchingWord","hideArrow","innerHeight","$current","$next","selectItem","$nextGroup","$prev","$prevGroup","nodeFromItem","rangeCompute","hintSelect","hintIdx","moveUp","moveDown","search","searchKeyword","createItemTemplates","hintMode","getWordsRange","getWordsMatchRange","empty","bnd","createGroup","version","Codeview","toolbarPosition","tabDisabled","textareaAutoSync","onBeforeCommand","onBlur","onBlurCodeview","onChange","onChangeCodeview","onEnter","onFocus","onImageUploadError","onInit","onKeydown","onKeyup","onMousedown","onMouseup","onPaste","onScroll","htmlMode","lineNumbers","pc","mac","TooltipUI","placement","$tooltip","showCallback","hideCallback","toggleCallback","targetOffset","nodeWidth","nodeHeight","tooltipWidth","tooltipHeight","DropdownUI","setEvent","stopImmediatePropagation","windowWidth","targetMarginRight","isOpened","ModalUI","$modal","$backdrop","which","renderer","airEditor","airEditable","$temp","$a","itemClick","caret","dropdownButton","opt","dropdownCheckButton","paragraphDropdownButton","tableDropdownButton","mousemove","rowSize","colSize","colorName","colorDropdownButton","currentClick","foreinput","getElementById","backinput","videoDialog","imageDialog","linkDialog","iconClassName","editorOptions","isEnable","isActive","check","$dom","getPopoverContent","getDialogBody","interface"],"mappings":";CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,gBAC7B,GAAqB,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,OACf,CACJ,IAAIM,EAAuB,iBAAZL,QAAuBD,EAAQG,QAAQ,WAAaH,EAAQD,EAAa,QACxF,IAAI,IAAIQ,KAAKD,GAAuB,iBAAZL,QAAuBA,QAAUF,GAAMQ,GAAKD,EAAEC,IAPxE,CASGC,QAAQ,SAASC,GACpB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUX,QAGnC,IAAIC,EAASQ,EAAiBE,GAAY,CACzCL,EAAGK,EACHC,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQF,GAAUG,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,QAASU,GAG/DT,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAU,EAAoBK,EAAIF,EAGxBH,EAAoBM,EAAIP,EAGxBC,EAAoBO,EAAI,SAASjB,EAASkB,EAAMC,GAC3CT,EAAoBU,EAAEpB,EAASkB,IAClCG,OAAOC,eAAetB,EAASkB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhET,EAAoBe,EAAI,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if(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"jquery\")) : factory(root[\"jQuery\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function(__WEBPACK_EXTERNAL_MODULE__0__) {\nreturn "," \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 51);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","import $ from 'jquery';\n\nclass Renderer {\n constructor(markup, children, options, callback) {\n this.markup = markup;\n this.children = children;\n this.options = options;\n this.callback = callback;\n }\n\n render($parent) {\n const $node = $(this.markup);\n\n if (this.options && this.options.contents) {\n $node.html(this.options.contents);\n }\n\n if (this.options && this.options.className) {\n $node.addClass(this.options.className);\n }\n\n if (this.options && this.options.data) {\n $.each(this.options.data, (k, v) => {\n $node.attr('data-' + k, v);\n });\n }\n\n if (this.options && this.options.click) {\n $node.on('click', this.options.click);\n }\n\n if (this.children) {\n const $container = $node.find('.note-children-container');\n this.children.forEach((child) => {\n child.render($container.length ? $container : $node);\n });\n }\n\n if (this.callback) {\n this.callback($node, this.options);\n }\n\n if (this.options && this.options.callback) {\n this.options.callback($node);\n }\n\n if ($parent) {\n $parent.append($node);\n }\n\n return $node;\n }\n}\n\nexport default {\n create: (markup, callback) => {\n return function() {\n const options = typeof arguments[1] === 'object' ? arguments[1] : arguments[0];\n let children = Array.isArray(arguments[0]) ? arguments[0] : [];\n if (options && options.children) {\n children = options.children;\n }\n return new Renderer(markup, children, options, callback);\n };\n },\n};\n","/* globals __webpack_amd_options__ */\nmodule.exports = __webpack_amd_options__;\n","import $ from 'jquery';\n\n$.summernote = $.summernote || {\n lang: {},\n};\n\n$.extend($.summernote.lang, {\n 'en-US': {\n font: {\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n clear: 'Remove Font Style',\n height: 'Line Height',\n name: 'Font Family',\n strikethrough: 'Strikethrough',\n subscript: 'Subscript',\n superscript: 'Superscript',\n size: 'Font Size',\n sizeunit: 'Font Size Unit',\n },\n image: {\n image: 'Picture',\n insert: 'Insert Image',\n resizeFull: 'Resize full',\n resizeHalf: 'Resize half',\n resizeQuarter: 'Resize quarter',\n resizeNone: 'Original size',\n floatLeft: 'Float Left',\n floatRight: 'Float Right',\n floatNone: 'Remove float',\n shapeRounded: 'Shape: Rounded',\n shapeCircle: 'Shape: Circle',\n shapeThumbnail: 'Shape: Thumbnail',\n shapeNone: 'Shape: None',\n dragImageHere: 'Drag image or text here',\n dropImage: 'Drop image or Text',\n selectFromFiles: 'Select from files',\n maximumFileSize: 'Maximum file size',\n maximumFileSizeError: 'Maximum file size exceeded.',\n url: 'Image URL',\n remove: 'Remove Image',\n original: 'Original',\n },\n video: {\n video: 'Video',\n videoLink: 'Video Link',\n insert: 'Insert Video',\n url: 'Video URL',\n providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)',\n },\n link: {\n link: 'Link',\n insert: 'Insert Link',\n unlink: 'Unlink',\n edit: 'Edit',\n textToDisplay: 'Text to display',\n url: 'To what URL should this link go?',\n openInNewWindow: 'Open in new window',\n useProtocol: 'Use default protocol',\n },\n table: {\n table: 'Table',\n addRowAbove: 'Add row above',\n addRowBelow: 'Add row below',\n addColLeft: 'Add column left',\n addColRight: 'Add column right',\n delRow: 'Delete row',\n delCol: 'Delete column',\n delTable: 'Delete table',\n },\n hr: {\n insert: 'Insert Horizontal Rule',\n },\n style: {\n style: 'Style',\n p: 'Normal',\n blockquote: 'Quote',\n pre: 'Code',\n h1: 'Header 1',\n h2: 'Header 2',\n h3: 'Header 3',\n h4: 'Header 4',\n h5: 'Header 5',\n h6: 'Header 6',\n },\n lists: {\n unordered: 'Unordered list',\n ordered: 'Ordered list',\n },\n options: {\n help: 'Help',\n fullscreen: 'Full Screen',\n codeview: 'Code View',\n },\n paragraph: {\n paragraph: 'Paragraph',\n outdent: 'Outdent',\n indent: 'Indent',\n left: 'Align left',\n center: 'Align center',\n right: 'Align right',\n justify: 'Justify full',\n },\n color: {\n recent: 'Recent Color',\n more: 'More Color',\n background: 'Background Color',\n foreground: 'Text Color',\n transparent: 'Transparent',\n setTransparent: 'Set transparent',\n reset: 'Reset',\n resetToDefault: 'Reset to default',\n cpSelect: 'Select',\n },\n shortcut: {\n shortcuts: 'Keyboard shortcuts',\n close: 'Close',\n textFormatting: 'Text formatting',\n action: 'Action',\n paragraphFormatting: 'Paragraph formatting',\n documentStyle: 'Document Style',\n extraKeys: 'Extra keys',\n },\n help: {\n 'insertParagraph': 'Insert Paragraph',\n 'undo': 'Undoes the last command',\n 'redo': 'Redoes the last command',\n 'tab': 'Tab',\n 'untab': 'Untab',\n 'bold': 'Set a bold style',\n 'italic': 'Set a italic style',\n 'underline': 'Set a underline style',\n 'strikethrough': 'Set a strikethrough style',\n 'removeFormat': 'Clean a style',\n 'justifyLeft': 'Set left align',\n 'justifyCenter': 'Set center align',\n 'justifyRight': 'Set right align',\n 'justifyFull': 'Set full align',\n 'insertUnorderedList': 'Toggle unordered list',\n 'insertOrderedList': 'Toggle ordered list',\n 'outdent': 'Outdent on current paragraph',\n 'indent': 'Indent on current paragraph',\n 'formatPara': 'Change current block\\'s format as a paragraph(P tag)',\n 'formatH1': 'Change current block\\'s format as H1',\n 'formatH2': 'Change current block\\'s format as H2',\n 'formatH3': 'Change current block\\'s format as H3',\n 'formatH4': 'Change current block\\'s format as H4',\n 'formatH5': 'Change current block\\'s format as H5',\n 'formatH6': 'Change current block\\'s format as H6',\n 'insertHorizontalRule': 'Insert horizontal rule',\n 'linkDialog.show': 'Show Link Dialog',\n },\n history: {\n undo: 'Undo',\n redo: 'Redo',\n },\n specialChar: {\n specialChar: 'SPECIAL CHARACTERS',\n select: 'Select Special characters',\n },\n output: {\n noSelection: 'No Selection Made!',\n },\n },\n});\n","import $ from 'jquery';\nconst isSupportAmd = typeof define === 'function' && define.amd; // eslint-disable-line\n\n/**\n * returns whether font is installed or not.\n *\n * @param {String} fontName\n * @return {Boolean}\n */\nconst genericFontFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];\n\nfunction validFontName(fontName) {\n return ($.inArray(fontName.toLowerCase(), genericFontFamilies) === -1) ? `'${fontName}'` : fontName;\n}\n\nfunction isFontInstalled(fontName) {\n const testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';\n const testText = 'mmmmmmmmmmwwwww';\n const testSize = '200px';\n\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n\n context.font = testSize + \" '\" + testFontName + \"'\";\n const originalWidth = context.measureText(testText).width;\n\n context.font = testSize + ' ' + validFontName(fontName) + ', \"' + testFontName + '\"';\n const width = context.measureText(testText).width;\n\n return originalWidth !== width;\n}\n\nconst userAgent = navigator.userAgent;\nconst isMSIE = /MSIE|Trident/i.test(userAgent);\nlet browserVersion;\nif (isMSIE) {\n let matches = /MSIE (\\d+[.]\\d+)/.exec(userAgent);\n if (matches) {\n browserVersion = parseFloat(matches[1]);\n }\n matches = /Trident\\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);\n if (matches) {\n browserVersion = parseFloat(matches[1]);\n }\n}\n\nconst isEdge = /Edge\\/\\d+/.test(userAgent);\n\nlet hasCodeMirror = !!window.CodeMirror;\n\nconst isSupportTouch =\n (('ontouchstart' in window) ||\n (navigator.MaxTouchPoints > 0) ||\n (navigator.msMaxTouchPoints > 0));\n\n// [workaround] IE doesn't have input events for contentEditable\n// - see: https://goo.gl/4bfIvA\nconst inputEventName = (isMSIE) ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';\n\n/**\n * @class core.env\n *\n * Object which check platform and agent\n *\n * @singleton\n * @alternateClassName env\n */\nexport default {\n isMac: navigator.appVersion.indexOf('Mac') > -1,\n isMSIE,\n isEdge,\n isFF: !isEdge && /firefox/i.test(userAgent),\n isPhantom: /PhantomJS/i.test(userAgent),\n isWebkit: !isEdge && /webkit/i.test(userAgent),\n isChrome: !isEdge && /chrome/i.test(userAgent),\n isSafari: !isEdge && /safari/i.test(userAgent) && (!/chrome/i.test(userAgent)),\n browserVersion,\n jqueryVersion: parseFloat($.fn.jquery),\n isSupportAmd,\n isSupportTouch,\n hasCodeMirror,\n isFontInstalled,\n isW3CRangeSupport: !!document.createRange,\n inputEventName,\n genericFontFamilies,\n validFontName,\n};\n","import $ from 'jquery';\n\n/**\n * @class core.func\n *\n * func utils (for high-order func's arg)\n *\n * @singleton\n * @alternateClassName func\n */\nfunction eq(itemA) {\n return function(itemB) {\n return itemA === itemB;\n };\n}\n\nfunction eq2(itemA, itemB) {\n return itemA === itemB;\n}\n\nfunction peq2(propName) {\n return function(itemA, itemB) {\n return itemA[propName] === itemB[propName];\n };\n}\n\nfunction ok() {\n return true;\n}\n\nfunction fail() {\n return false;\n}\n\nfunction not(f) {\n return function() {\n return !f.apply(f, arguments);\n };\n}\n\nfunction and(fA, fB) {\n return function(item) {\n return fA(item) && fB(item);\n };\n}\n\nfunction self(a) {\n return a;\n}\n\nfunction invoke(obj, method) {\n return function() {\n return obj[method].apply(obj, arguments);\n };\n}\n\nlet idCounter = 0;\n\n/**\n * reset globally-unique id\n *\n */\nfunction resetUniqueId() {\n idCounter = 0;\n}\n\n/**\n * generate a globally-unique id\n *\n * @param {String} [prefix]\n */\nfunction uniqueId(prefix) {\n const id = ++idCounter + '';\n return prefix ? prefix + id : id;\n}\n\n/**\n * returns bnd (bounds) from rect\n *\n * - IE Compatibility Issue: http://goo.gl/sRLOAo\n * - Scroll Issue: http://goo.gl/sNjUc\n *\n * @param {Rect} rect\n * @return {Object} bounds\n * @return {Number} bounds.top\n * @return {Number} bounds.left\n * @return {Number} bounds.width\n * @return {Number} bounds.height\n */\nfunction rect2bnd(rect) {\n const $document = $(document);\n return {\n top: rect.top + $document.scrollTop(),\n left: rect.left + $document.scrollLeft(),\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n}\n\n/**\n * returns a copy of the object where the keys have become the values and the values the keys.\n * @param {Object} obj\n * @return {Object}\n */\nfunction invertObject(obj) {\n const inverted = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n inverted[obj[key]] = key;\n }\n }\n return inverted;\n}\n\n/**\n * @param {String} namespace\n * @param {String} [prefix]\n * @return {String}\n */\nfunction namespaceToCamel(namespace, prefix) {\n prefix = prefix || '';\n return prefix + namespace.split('.').map(function(name) {\n return name.substring(0, 1).toUpperCase() + name.substring(1);\n }).join('');\n}\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param {Function} func\n * @param {Number} wait\n * @param {Boolean} immediate\n * @return {Function}\n */\nfunction debounce(func, wait, immediate) {\n let timeout;\n return function() {\n const context = this;\n const args = arguments;\n const later = () => {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n}\n\n/**\n *\n * @param {String} url\n * @return {Boolean}\n */\nfunction isValidUrl(url) {\n const expression = /[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)/gi;\n return expression.test(url);\n}\n\nexport default {\n eq,\n eq2,\n peq2,\n ok,\n fail,\n self,\n not,\n and,\n invoke,\n resetUniqueId,\n uniqueId,\n rect2bnd,\n invertObject,\n namespaceToCamel,\n debounce,\n isValidUrl,\n};\n","import func from './func';\n\n/**\n * returns the first item of an array.\n *\n * @param {Array} array\n */\nfunction head(array) {\n return array[0];\n}\n\n/**\n * returns the last item of an array.\n *\n * @param {Array} array\n */\nfunction last(array) {\n return array[array.length - 1];\n}\n\n/**\n * returns everything but the last entry of the array.\n *\n * @param {Array} array\n */\nfunction initial(array) {\n return array.slice(0, array.length - 1);\n}\n\n/**\n * returns the rest of the items in an array.\n *\n * @param {Array} array\n */\nfunction tail(array) {\n return array.slice(1);\n}\n\n/**\n * returns item of array\n */\nfunction find(array, pred) {\n for (let idx = 0, len = array.length; idx < len; idx++) {\n const item = array[idx];\n if (pred(item)) {\n return item;\n }\n }\n}\n\n/**\n * returns true if all of the values in the array pass the predicate truth test.\n */\nfunction all(array, pred) {\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (!pred(array[idx])) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * returns true if the value is present in the list.\n */\nfunction contains(array, item) {\n if (array && array.length && item) {\n if (array.indexOf) {\n return array.indexOf(item) !== -1;\n } else if (array.contains) {\n // `DOMTokenList` doesn't implement `.indexOf`, but it implements `.contains`\n return array.contains(item);\n }\n }\n return false;\n}\n\n/**\n * get sum from a list\n *\n * @param {Array} array - array\n * @param {Function} fn - iterator\n */\nfunction sum(array, fn) {\n fn = fn || func.self;\n return array.reduce(function(memo, v) {\n return memo + fn(v);\n }, 0);\n}\n\n/**\n * returns a copy of the collection with array type.\n * @param {Collection} collection - collection eg) node.childNodes, ...\n */\nfunction from(collection) {\n const result = [];\n const length = collection.length;\n let idx = -1;\n while (++idx < length) {\n result[idx] = collection[idx];\n }\n return result;\n}\n\n/**\n * returns whether list is empty or not\n */\nfunction isEmpty(array) {\n return !array || !array.length;\n}\n\n/**\n * cluster elements by predicate function.\n *\n * @param {Array} array - array\n * @param {Function} fn - predicate function for cluster rule\n * @param {Array[]}\n */\nfunction clusterBy(array, fn) {\n if (!array.length) { return []; }\n const aTail = tail(array);\n return aTail.reduce(function(memo, v) {\n const aLast = last(memo);\n if (fn(last(aLast), v)) {\n aLast[aLast.length] = v;\n } else {\n memo[memo.length] = [v];\n }\n return memo;\n }, [[head(array)]]);\n}\n\n/**\n * returns a copy of the array with all false values removed\n *\n * @param {Array} array - array\n * @param {Function} fn - predicate function for cluster rule\n */\nfunction compact(array) {\n const aResult = [];\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (array[idx]) { aResult.push(array[idx]); }\n }\n return aResult;\n}\n\n/**\n * produces a duplicate-free version of the array\n *\n * @param {Array} array\n */\nfunction unique(array) {\n const results = [];\n\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (!contains(results, array[idx])) {\n results.push(array[idx]);\n }\n }\n\n return results;\n}\n\n/**\n * returns next item.\n * @param {Array} array\n */\nfunction next(array, item) {\n if (array && array.length && item) {\n const idx = array.indexOf(item);\n return idx === -1 ? null : array[idx + 1];\n }\n return null;\n}\n\n/**\n * returns prev item.\n * @param {Array} array\n */\nfunction prev(array, item) {\n if (array && array.length && item) {\n const idx = array.indexOf(item);\n return idx === -1 ? null : array[idx - 1];\n }\n return null;\n}\n\n/**\n * @class core.list\n *\n * list utils\n *\n * @singleton\n * @alternateClassName list\n */\nexport default {\n head,\n last,\n initial,\n tail,\n prev,\n next,\n find,\n contains,\n all,\n sum,\n from,\n isEmpty,\n clusterBy,\n compact,\n unique,\n};\n","import $ from 'jquery';\nimport func from './func';\nimport lists from './lists';\nimport env from './env';\n\nconst NBSP_CHAR = String.fromCharCode(160);\nconst ZERO_WIDTH_NBSP_CHAR = '\\ufeff';\n\n/**\n * @method isEditable\n *\n * returns whether node is `note-editable` or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isEditable(node) {\n return node && $(node).hasClass('note-editable');\n}\n\n/**\n * @method isControlSizing\n *\n * returns whether node is `note-control-sizing` or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isControlSizing(node) {\n return node && $(node).hasClass('note-control-sizing');\n}\n\n/**\n * @method makePredByNodeName\n *\n * returns predicate which judge whether nodeName is same\n *\n * @param {String} nodeName\n * @return {Function}\n */\nfunction makePredByNodeName(nodeName) {\n nodeName = nodeName.toUpperCase();\n return function(node) {\n return node && node.nodeName.toUpperCase() === nodeName;\n };\n}\n\n/**\n * @method isText\n *\n *\n *\n * @param {Node} node\n * @return {Boolean} true if node's type is text(3)\n */\nfunction isText(node) {\n return node && node.nodeType === 3;\n}\n\n/**\n * @method isElement\n *\n *\n *\n * @param {Node} node\n * @return {Boolean} true if node's type is element(1)\n */\nfunction isElement(node) {\n return node && node.nodeType === 1;\n}\n\n/**\n * ex) br, col, embed, hr, img, input, ...\n * @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements\n */\nfunction isVoid(node) {\n return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(node.nodeName.toUpperCase());\n}\n\nfunction isPara(node) {\n if (isEditable(node)) {\n return false;\n }\n\n // Chrome(v31.0), FF(v25.0.1) use DIV for paragraph\n return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase());\n}\n\nfunction isHeading(node) {\n return node && /^H[1-7]/.test(node.nodeName.toUpperCase());\n}\n\nconst isPre = makePredByNodeName('PRE');\n\nconst isLi = makePredByNodeName('LI');\n\nfunction isPurePara(node) {\n return isPara(node) && !isLi(node);\n}\n\nconst isTable = makePredByNodeName('TABLE');\n\nconst isData = makePredByNodeName('DATA');\n\nfunction isInline(node) {\n return !isBodyContainer(node) &&\n !isList(node) &&\n !isHr(node) &&\n !isPara(node) &&\n !isTable(node) &&\n !isBlockquote(node) &&\n !isData(node);\n}\n\nfunction isList(node) {\n return node && /^UL|^OL/.test(node.nodeName.toUpperCase());\n}\n\nconst isHr = makePredByNodeName('HR');\n\nfunction isCell(node) {\n return node && /^TD|^TH/.test(node.nodeName.toUpperCase());\n}\n\nconst isBlockquote = makePredByNodeName('BLOCKQUOTE');\n\nfunction isBodyContainer(node) {\n return isCell(node) || isBlockquote(node) || isEditable(node);\n}\n\nconst isAnchor = makePredByNodeName('A');\n\nfunction isParaInline(node) {\n return isInline(node) && !!ancestor(node, isPara);\n}\n\nfunction isBodyInline(node) {\n return isInline(node) && !ancestor(node, isPara);\n}\n\nconst isBody = makePredByNodeName('BODY');\n\n/**\n * returns whether nodeB is closest sibling of nodeA\n *\n * @param {Node} nodeA\n * @param {Node} nodeB\n * @return {Boolean}\n */\nfunction isClosestSibling(nodeA, nodeB) {\n return nodeA.nextSibling === nodeB ||\n nodeA.previousSibling === nodeB;\n}\n\n/**\n * returns array of closest siblings with node\n *\n * @param {Node} node\n * @param {function} [pred] - predicate function\n * @return {Node[]}\n */\nfunction withClosestSiblings(node, pred) {\n pred = pred || func.ok;\n\n const siblings = [];\n if (node.previousSibling && pred(node.previousSibling)) {\n siblings.push(node.previousSibling);\n }\n siblings.push(node);\n if (node.nextSibling && pred(node.nextSibling)) {\n siblings.push(node.nextSibling);\n }\n return siblings;\n}\n\n/**\n * blank HTML for cursor position\n * - [workaround] old IE only works with &nbsp;\n * - [workaround] IE11 and other browser works with bogus br\n */\nconst blankHTML = env.isMSIE && env.browserVersion < 11 ? '&nbsp;' : '<br>';\n\n/**\n * @method nodeLength\n *\n * returns #text's text size or element's childNodes size\n *\n * @param {Node} node\n */\nfunction nodeLength(node) {\n if (isText(node)) {\n return node.nodeValue.length;\n }\n\n if (node) {\n return node.childNodes.length;\n }\n\n return 0;\n}\n\n/**\n * returns whether deepest child node is empty or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction deepestChildIsEmpty(node) {\n do {\n if (node.firstElementChild === null || node.firstElementChild.innerHTML === '') break;\n } while ((node = node.firstElementChild));\n\n return isEmpty(node);\n}\n\n/**\n * returns whether node is empty or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isEmpty(node) {\n const len = nodeLength(node);\n\n if (len === 0) {\n return true;\n } else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {\n // ex) <p><br></p>, <span><br></span>\n return true;\n } else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {\n // ex) <p></p>, <span></span>\n return true;\n }\n\n return false;\n}\n\n/**\n * padding blankHTML if node is empty (for cursor position)\n */\nfunction paddingBlankHTML(node) {\n if (!isVoid(node) && !nodeLength(node)) {\n node.innerHTML = blankHTML;\n }\n}\n\n/**\n * find nearest ancestor predicate hit\n *\n * @param {Node} node\n * @param {Function} pred - predicate function\n */\nfunction ancestor(node, pred) {\n while (node) {\n if (pred(node)) { return node; }\n if (isEditable(node)) { break; }\n\n node = node.parentNode;\n }\n return null;\n}\n\n/**\n * find nearest ancestor only single child blood line and predicate hit\n *\n * @param {Node} node\n * @param {Function} pred - predicate function\n */\nfunction singleChildAncestor(node, pred) {\n node = node.parentNode;\n\n while (node) {\n if (nodeLength(node) !== 1) { break; }\n if (pred(node)) { return node; }\n if (isEditable(node)) { break; }\n\n node = node.parentNode;\n }\n return null;\n}\n\n/**\n * returns new array of ancestor nodes (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [optional] pred - predicate function\n */\nfunction listAncestor(node, pred) {\n pred = pred || func.fail;\n\n const ancestors = [];\n ancestor(node, function(el) {\n if (!isEditable(el)) {\n ancestors.push(el);\n }\n\n return pred(el);\n });\n return ancestors;\n}\n\n/**\n * find farthest ancestor predicate hit\n */\nfunction lastAncestor(node, pred) {\n const ancestors = listAncestor(node);\n return lists.last(ancestors.filter(pred));\n}\n\n/**\n * returns common ancestor node between two nodes.\n *\n * @param {Node} nodeA\n * @param {Node} nodeB\n */\nfunction commonAncestor(nodeA, nodeB) {\n const ancestors = listAncestor(nodeA);\n for (let n = nodeB; n; n = n.parentNode) {\n if (ancestors.indexOf(n) > -1) return n;\n }\n return null; // difference document area\n}\n\n/**\n * listing all previous siblings (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [optional] pred - predicate function\n */\nfunction listPrev(node, pred) {\n pred = pred || func.fail;\n\n const nodes = [];\n while (node) {\n if (pred(node)) { break; }\n nodes.push(node);\n node = node.previousSibling;\n }\n return nodes;\n}\n\n/**\n * listing next siblings (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [pred] - predicate function\n */\nfunction listNext(node, pred) {\n pred = pred || func.fail;\n\n const nodes = [];\n while (node) {\n if (pred(node)) { break; }\n nodes.push(node);\n node = node.nextSibling;\n }\n return nodes;\n}\n\n/**\n * listing descendant nodes\n *\n * @param {Node} node\n * @param {Function} [pred] - predicate function\n */\nfunction listDescendant(node, pred) {\n const descendants = [];\n pred = pred || func.ok;\n\n // start DFS(depth first search) with node\n (function fnWalk(current) {\n if (node !== current && pred(current)) {\n descendants.push(current);\n }\n for (let idx = 0, len = current.childNodes.length; idx < len; idx++) {\n fnWalk(current.childNodes[idx]);\n }\n })(node);\n\n return descendants;\n}\n\n/**\n * wrap node with new tag.\n *\n * @param {Node} node\n * @param {Node} tagName of wrapper\n * @return {Node} - wrapper\n */\nfunction wrap(node, wrapperName) {\n const parent = node.parentNode;\n const wrapper = $('<' + wrapperName + '>')[0];\n\n parent.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n\n return wrapper;\n}\n\n/**\n * insert node after preceding\n *\n * @param {Node} node\n * @param {Node} preceding - predicate function\n */\nfunction insertAfter(node, preceding) {\n const next = preceding.nextSibling;\n let parent = preceding.parentNode;\n if (next) {\n parent.insertBefore(node, next);\n } else {\n parent.appendChild(node);\n }\n return node;\n}\n\n/**\n * append elements.\n *\n * @param {Node} node\n * @param {Collection} aChild\n */\nfunction appendChildNodes(node, aChild) {\n $.each(aChild, function(idx, child) {\n node.appendChild(child);\n });\n return node;\n}\n\n/**\n * returns whether boundaryPoint is left edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isLeftEdgePoint(point) {\n return point.offset === 0;\n}\n\n/**\n * returns whether boundaryPoint is right edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isRightEdgePoint(point) {\n return point.offset === nodeLength(point.node);\n}\n\n/**\n * returns whether boundaryPoint is edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isEdgePoint(point) {\n return isLeftEdgePoint(point) || isRightEdgePoint(point);\n}\n\n/**\n * returns whether node is left edge of ancestor or not.\n *\n * @param {Node} node\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isLeftEdgeOf(node, ancestor) {\n while (node && node !== ancestor) {\n if (position(node) !== 0) {\n return false;\n }\n node = node.parentNode;\n }\n\n return true;\n}\n\n/**\n * returns whether node is right edge of ancestor or not.\n *\n * @param {Node} node\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isRightEdgeOf(node, ancestor) {\n if (!ancestor) {\n return false;\n }\n while (node && node !== ancestor) {\n if (position(node) !== nodeLength(node.parentNode) - 1) {\n return false;\n }\n node = node.parentNode;\n }\n\n return true;\n}\n\n/**\n * returns whether point is left edge of ancestor or not.\n * @param {BoundaryPoint} point\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isLeftEdgePointOf(point, ancestor) {\n return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor);\n}\n\n/**\n * returns whether point is right edge of ancestor or not.\n * @param {BoundaryPoint} point\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isRightEdgePointOf(point, ancestor) {\n return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor);\n}\n\n/**\n * returns offset from parent.\n *\n * @param {Node} node\n */\nfunction position(node) {\n let offset = 0;\n while ((node = node.previousSibling)) {\n offset += 1;\n }\n return offset;\n}\n\nfunction hasChildren(node) {\n return !!(node && node.childNodes && node.childNodes.length);\n}\n\n/**\n * returns previous boundaryPoint\n *\n * @param {BoundaryPoint} point\n * @param {Boolean} isSkipInnerOffset\n * @return {BoundaryPoint}\n */\nfunction prevPoint(point, isSkipInnerOffset) {\n let node;\n let offset;\n\n if (point.offset === 0) {\n if (isEditable(point.node)) {\n return null;\n }\n\n node = point.node.parentNode;\n offset = position(point.node);\n } else if (hasChildren(point.node)) {\n node = point.node.childNodes[point.offset - 1];\n offset = nodeLength(node);\n } else {\n node = point.node;\n offset = isSkipInnerOffset ? 0 : point.offset - 1;\n }\n\n return {\n node: node,\n offset: offset,\n };\n}\n\n/**\n * returns next boundaryPoint\n *\n * @param {BoundaryPoint} point\n * @param {Boolean} isSkipInnerOffset\n * @return {BoundaryPoint}\n */\nfunction nextPoint(point, isSkipInnerOffset) {\n let node, offset;\n\n if (isEmpty(point.node)) {\n return null;\n }\n\n if (nodeLength(point.node) === point.offset) {\n if (isEditable(point.node)) {\n return null;\n }\n\n node = point.node.parentNode;\n offset = position(point.node) + 1;\n } else if (hasChildren(point.node)) {\n node = point.node.childNodes[point.offset];\n offset = 0;\n if (isEmpty(node)) {\n return null;\n }\n } else {\n node = point.node;\n offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;\n\n if (isEmpty(node)) {\n return null;\n }\n }\n\n return {\n node: node,\n offset: offset,\n };\n}\n\n/**\n * returns whether pointA and pointB is same or not.\n *\n * @param {BoundaryPoint} pointA\n * @param {BoundaryPoint} pointB\n * @return {Boolean}\n */\nfunction isSamePoint(pointA, pointB) {\n return pointA.node === pointB.node && pointA.offset === pointB.offset;\n}\n\n/**\n * returns whether point is visible (can set cursor) or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isVisiblePoint(point) {\n if (isText(point.node) || !hasChildren(point.node) || isEmpty(point.node)) {\n return true;\n }\n\n const leftNode = point.node.childNodes[point.offset - 1];\n const rightNode = point.node.childNodes[point.offset];\n if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode))) {\n return true;\n }\n\n return false;\n}\n\n/**\n * @method prevPointUtil\n *\n * @param {BoundaryPoint} point\n * @param {Function} pred\n * @return {BoundaryPoint}\n */\nfunction prevPointUntil(point, pred) {\n while (point) {\n if (pred(point)) {\n return point;\n }\n\n point = prevPoint(point);\n }\n\n return null;\n}\n\n/**\n * @method nextPointUntil\n *\n * @param {BoundaryPoint} point\n * @param {Function} pred\n * @return {BoundaryPoint}\n */\nfunction nextPointUntil(point, pred) {\n while (point) {\n if (pred(point)) {\n return point;\n }\n\n point = nextPoint(point);\n }\n\n return null;\n}\n\n/**\n * returns whether point has character or not.\n *\n * @param {Point} point\n * @return {Boolean}\n */\nfunction isCharPoint(point) {\n if (!isText(point.node)) {\n return false;\n }\n\n const ch = point.node.nodeValue.charAt(point.offset - 1);\n return ch && (ch !== ' ' && ch !== NBSP_CHAR);\n}\n\n/**\n * returns whether point has space or not.\n *\n * @param {Point} point\n * @return {Boolean}\n */\nfunction isSpacePoint(point) {\n if (!isText(point.node)) {\n return false;\n }\n\n const ch = point.node.nodeValue.charAt(point.offset - 1);\n return ch === ' ' || ch === NBSP_CHAR;\n}\n\n/**\n * @method walkPoint\n *\n * @param {BoundaryPoint} startPoint\n * @param {BoundaryPoint} endPoint\n * @param {Function} handler\n * @param {Boolean} isSkipInnerOffset\n */\nfunction walkPoint(startPoint, endPoint, handler, isSkipInnerOffset) {\n let point = startPoint;\n\n while (point) {\n handler(point);\n\n if (isSamePoint(point, endPoint)) {\n break;\n }\n\n const isSkipOffset = isSkipInnerOffset &&\n startPoint.node !== point.node &&\n endPoint.node !== point.node;\n point = nextPoint(point, isSkipOffset);\n }\n}\n\n/**\n * @method makeOffsetPath\n *\n * return offsetPath(array of offset) from ancestor\n *\n * @param {Node} ancestor - ancestor node\n * @param {Node} node\n */\nfunction makeOffsetPath(ancestor, node) {\n const ancestors = listAncestor(node, func.eq(ancestor));\n return ancestors.map(position).reverse();\n}\n\n/**\n * @method fromOffsetPath\n *\n * return element from offsetPath(array of offset)\n *\n * @param {Node} ancestor - ancestor node\n * @param {array} offsets - offsetPath\n */\nfunction fromOffsetPath(ancestor, offsets) {\n let current = ancestor;\n for (let i = 0, len = offsets.length; i < len; i++) {\n if (current.childNodes.length <= offsets[i]) {\n current = current.childNodes[current.childNodes.length - 1];\n } else {\n current = current.childNodes[offsets[i]];\n }\n }\n return current;\n}\n\n/**\n * @method splitNode\n *\n * split element or #text\n *\n * @param {BoundaryPoint} point\n * @param {Object} [options]\n * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false\n * @param {Boolean} [options.isNotSplitEdgePoint] - default: false\n * @param {Boolean} [options.isDiscardEmptySplits] - default: false\n * @return {Node} right node of boundaryPoint\n */\nfunction splitNode(point, options) {\n let isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;\n const isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;\n const isDiscardEmptySplits = options && options.isDiscardEmptySplits;\n\n if (isDiscardEmptySplits) {\n isSkipPaddingBlankHTML = true;\n }\n\n // edge case\n if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {\n if (isLeftEdgePoint(point)) {\n return point.node;\n } else if (isRightEdgePoint(point)) {\n return point.node.nextSibling;\n }\n }\n\n // split #text\n if (isText(point.node)) {\n return point.node.splitText(point.offset);\n } else {\n const childNode = point.node.childNodes[point.offset];\n const clone = insertAfter(point.node.cloneNode(false), point.node);\n appendChildNodes(clone, listNext(childNode));\n\n if (!isSkipPaddingBlankHTML) {\n paddingBlankHTML(point.node);\n paddingBlankHTML(clone);\n }\n\n if (isDiscardEmptySplits) {\n if (isEmpty(point.node)) {\n remove(point.node);\n }\n if (isEmpty(clone)) {\n remove(clone);\n return point.node.nextSibling;\n }\n }\n\n return clone;\n }\n}\n\n/**\n * @method splitTree\n *\n * split tree by point\n *\n * @param {Node} root - split root\n * @param {BoundaryPoint} point\n * @param {Object} [options]\n * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false\n * @param {Boolean} [options.isNotSplitEdgePoint] - default: false\n * @return {Node} right node of boundaryPoint\n */\nfunction splitTree(root, point, options) {\n // ex) [#text, <span>, <p>]\n const ancestors = listAncestor(point.node, func.eq(root));\n\n if (!ancestors.length) {\n return null;\n } else if (ancestors.length === 1) {\n return splitNode(point, options);\n }\n\n return ancestors.reduce(function(node, parent) {\n if (node === point.node) {\n node = splitNode(point, options);\n }\n\n return splitNode({\n node: parent,\n offset: node ? position(node) : nodeLength(parent),\n }, options);\n });\n}\n\n/**\n * split point\n *\n * @param {Point} point\n * @param {Boolean} isInline\n * @return {Object}\n */\nfunction splitPoint(point, isInline) {\n // find splitRoot, container\n // - inline: splitRoot is a child of paragraph\n // - block: splitRoot is a child of bodyContainer\n const pred = isInline ? isPara : isBodyContainer;\n const ancestors = listAncestor(point.node, pred);\n const topAncestor = lists.last(ancestors) || point.node;\n\n let splitRoot, container;\n if (pred(topAncestor)) {\n splitRoot = ancestors[ancestors.length - 2];\n container = topAncestor;\n } else {\n splitRoot = topAncestor;\n container = splitRoot.parentNode;\n }\n\n // if splitRoot is exists, split with splitTree\n let pivot = splitRoot && splitTree(splitRoot, point, {\n isSkipPaddingBlankHTML: isInline,\n isNotSplitEdgePoint: isInline,\n });\n\n // if container is point.node, find pivot with point.offset\n if (!pivot && container === point.node) {\n pivot = point.node.childNodes[point.offset];\n }\n\n return {\n rightNode: pivot,\n container: container,\n };\n}\n\nfunction create(nodeName) {\n return document.createElement(nodeName);\n}\n\nfunction createText(text) {\n return document.createTextNode(text);\n}\n\n/**\n * @method remove\n *\n * remove node, (isRemoveChild: remove child or not)\n *\n * @param {Node} node\n * @param {Boolean} isRemoveChild\n */\nfunction remove(node, isRemoveChild) {\n if (!node || !node.parentNode) { return; }\n if (node.removeNode) { return node.removeNode(isRemoveChild); }\n\n const parent = node.parentNode;\n if (!isRemoveChild) {\n const nodes = [];\n for (let i = 0, len = node.childNodes.length; i < len; i++) {\n nodes.push(node.childNodes[i]);\n }\n\n for (let i = 0, len = nodes.length; i < len; i++) {\n parent.insertBefore(nodes[i], node);\n }\n }\n\n parent.removeChild(node);\n}\n\n/**\n * @method removeWhile\n *\n * @param {Node} node\n * @param {Function} pred\n */\nfunction removeWhile(node, pred) {\n while (node) {\n if (isEditable(node) || !pred(node)) {\n break;\n }\n\n const parent = node.parentNode;\n remove(node);\n node = parent;\n }\n}\n\n/**\n * @method replace\n *\n * replace node with provided nodeName\n *\n * @param {Node} node\n * @param {String} nodeName\n * @return {Node} - new node\n */\nfunction replace(node, nodeName) {\n if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) {\n return node;\n }\n\n const newNode = create(nodeName);\n\n if (node.style.cssText) {\n newNode.style.cssText = node.style.cssText;\n }\n\n appendChildNodes(newNode, lists.from(node.childNodes));\n insertAfter(newNode, node);\n remove(node);\n\n return newNode;\n}\n\nconst isTextarea = makePredByNodeName('TEXTAREA');\n\n/**\n * @param {jQuery} $node\n * @param {Boolean} [stripLinebreaks] - default: false\n */\nfunction value($node, stripLinebreaks) {\n const val = isTextarea($node[0]) ? $node.val() : $node.html();\n if (stripLinebreaks) {\n return val.replace(/[\\n\\r]/g, '');\n }\n return val;\n}\n\n/**\n * @method html\n *\n * get the HTML contents of node\n *\n * @param {jQuery} $node\n * @param {Boolean} [isNewlineOnBlock]\n */\nfunction html($node, isNewlineOnBlock) {\n let markup = value($node);\n\n if (isNewlineOnBlock) {\n const regexTag = /<(\\/?)(\\b(?!!)[^>\\s]*)(.*?)(\\s*\\/?>)/g;\n markup = markup.replace(regexTag, function(match, endSlash, name) {\n name = name.toUpperCase();\n const isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) &&\n !!endSlash;\n const isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);\n\n return match + ((isEndOfInlineContainer || isBlockNode) ? '\\n' : '');\n });\n markup = markup.trim();\n }\n\n return markup;\n}\n\nfunction posFromPlaceholder(placeholder) {\n const $placeholder = $(placeholder);\n const pos = $placeholder.offset();\n const height = $placeholder.outerHeight(true); // include margin\n\n return {\n left: pos.left,\n top: pos.top + height,\n };\n}\n\nfunction attachEvents($node, events) {\n Object.keys(events).forEach(function(key) {\n $node.on(key, events[key]);\n });\n}\n\nfunction detachEvents($node, events) {\n Object.keys(events).forEach(function(key) {\n $node.off(key, events[key]);\n });\n}\n\n/**\n * @method isCustomStyleTag\n *\n * assert if a node contains a \"note-styletag\" class,\n * which implies that's a custom-made style tag node\n *\n * @param {Node} an HTML DOM node\n */\nfunction isCustomStyleTag(node) {\n return node && !isText(node) && lists.contains(node.classList, 'note-styletag');\n}\n\nexport default {\n /** @property {String} NBSP_CHAR */\n NBSP_CHAR,\n /** @property {String} ZERO_WIDTH_NBSP_CHAR */\n ZERO_WIDTH_NBSP_CHAR,\n /** @property {String} blank */\n blank: blankHTML,\n /** @property {String} emptyPara */\n emptyPara: `<p>${blankHTML}</p>`,\n makePredByNodeName,\n isEditable,\n isControlSizing,\n isText,\n isElement,\n isVoid,\n isPara,\n isPurePara,\n isHeading,\n isInline,\n isBlock: func.not(isInline),\n isBodyInline,\n isBody,\n isParaInline,\n isPre,\n isList,\n isTable,\n isData,\n isCell,\n isBlockquote,\n isBodyContainer,\n isAnchor,\n isDiv: makePredByNodeName('DIV'),\n isLi,\n isBR: makePredByNodeName('BR'),\n isSpan: makePredByNodeName('SPAN'),\n isB: makePredByNodeName('B'),\n isU: makePredByNodeName('U'),\n isS: makePredByNodeName('S'),\n isI: makePredByNodeName('I'),\n isImg: makePredByNodeName('IMG'),\n isTextarea,\n deepestChildIsEmpty,\n isEmpty,\n isEmptyAnchor: func.and(isAnchor, isEmpty),\n isClosestSibling,\n withClosestSiblings,\n nodeLength,\n isLeftEdgePoint,\n isRightEdgePoint,\n isEdgePoint,\n isLeftEdgeOf,\n isRightEdgeOf,\n isLeftEdgePointOf,\n isRightEdgePointOf,\n prevPoint,\n nextPoint,\n isSamePoint,\n isVisiblePoint,\n prevPointUntil,\n nextPointUntil,\n isCharPoint,\n isSpacePoint,\n walkPoint,\n ancestor,\n singleChildAncestor,\n listAncestor,\n lastAncestor,\n listNext,\n listPrev,\n listDescendant,\n commonAncestor,\n wrap,\n insertAfter,\n appendChildNodes,\n position,\n hasChildren,\n makeOffsetPath,\n fromOffsetPath,\n splitTree,\n splitPoint,\n create,\n createText,\n remove,\n removeWhile,\n replace,\n html,\n value,\n posFromPlaceholder,\n attachEvents,\n detachEvents,\n isCustomStyleTag,\n};\n","import $ from 'jquery';\nimport func from './core/func';\nimport lists from './core/lists';\nimport dom from './core/dom';\n\nexport default class Context {\n /**\n * @param {jQuery} $note\n * @param {Object} options\n */\n constructor($note, options) {\n this.$note = $note;\n\n this.memos = {};\n this.modules = {};\n this.layoutInfo = {};\n this.options = $.extend(true, {}, options);\n\n // init ui with options\n $.summernote.ui = $.summernote.ui_template(this.options);\n this.ui = $.summernote.ui;\n\n this.initialize();\n }\n\n /**\n * create layout and initialize modules and other resources\n */\n initialize() {\n this.layoutInfo = this.ui.createLayout(this.$note);\n this._initialize();\n this.$note.hide();\n return this;\n }\n\n /**\n * destroy modules and other resources and remove layout\n */\n destroy() {\n this._destroy();\n this.$note.removeData('summernote');\n this.ui.removeLayout(this.$note, this.layoutInfo);\n }\n\n /**\n * destory modules and other resources and initialize it again\n */\n reset() {\n const disabled = this.isDisabled();\n this.code(dom.emptyPara);\n this._destroy();\n this._initialize();\n\n if (disabled) {\n this.disable();\n }\n }\n\n _initialize() {\n // set own id\n this.options.id = func.uniqueId($.now());\n // set default container for tooltips, popovers, and dialogs\n this.options.container = this.options.container || this.layoutInfo.editor;\n\n // add optional buttons\n const buttons = $.extend({}, this.options.buttons);\n Object.keys(buttons).forEach((key) => {\n this.memo('button.' + key, buttons[key]);\n });\n\n const modules = $.extend({}, this.options.modules, $.summernote.plugins || {});\n\n // add and initialize modules\n Object.keys(modules).forEach((key) => {\n this.module(key, modules[key], true);\n });\n\n Object.keys(this.modules).forEach((key) => {\n this.initializeModule(key);\n });\n }\n\n _destroy() {\n // destroy modules with reversed order\n Object.keys(this.modules).reverse().forEach((key) => {\n this.removeModule(key);\n });\n\n Object.keys(this.memos).forEach((key) => {\n this.removeMemo(key);\n });\n // trigger custom onDestroy callback\n this.triggerEvent('destroy', this);\n }\n\n code(html) {\n const isActivated = this.invoke('codeview.isActivated');\n\n if (html === undefined) {\n this.invoke('codeview.sync');\n return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html();\n } else {\n if (isActivated) {\n this.layoutInfo.codable.val(html);\n } else {\n this.layoutInfo.editable.html(html);\n }\n this.$note.val(html);\n this.triggerEvent('change', html, this.layoutInfo.editable);\n }\n }\n\n isDisabled() {\n return this.layoutInfo.editable.attr('contenteditable') === 'false';\n }\n\n enable() {\n this.layoutInfo.editable.attr('contenteditable', true);\n this.invoke('toolbar.activate', true);\n this.triggerEvent('disable', false);\n this.options.editing = true;\n }\n\n disable() {\n // close codeview if codeview is opend\n if (this.invoke('codeview.isActivated')) {\n this.invoke('codeview.deactivate');\n }\n this.layoutInfo.editable.attr('contenteditable', false);\n this.options.editing = false;\n this.invoke('toolbar.deactivate', true);\n\n this.triggerEvent('disable', true);\n }\n\n triggerEvent() {\n const namespace = lists.head(arguments);\n const args = lists.tail(lists.from(arguments));\n\n const callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')];\n if (callback) {\n callback.apply(this.$note[0], args);\n }\n this.$note.trigger('summernote.' + namespace, args);\n }\n\n initializeModule(key) {\n const module = this.modules[key];\n module.shouldInitialize = module.shouldInitialize || func.ok;\n if (!module.shouldInitialize()) {\n return;\n }\n\n // initialize module\n if (module.initialize) {\n module.initialize();\n }\n\n // attach events\n if (module.events) {\n dom.attachEvents(this.$note, module.events);\n }\n }\n\n module(key, ModuleClass, withoutIntialize) {\n if (arguments.length === 1) {\n return this.modules[key];\n }\n\n this.modules[key] = new ModuleClass(this);\n\n if (!withoutIntialize) {\n this.initializeModule(key);\n }\n }\n\n removeModule(key) {\n const module = this.modules[key];\n if (module.shouldInitialize()) {\n if (module.events) {\n dom.detachEvents(this.$note, module.events);\n }\n\n if (module.destroy) {\n module.destroy();\n }\n }\n\n delete this.modules[key];\n }\n\n memo(key, obj) {\n if (arguments.length === 1) {\n return this.memos[key];\n }\n this.memos[key] = obj;\n }\n\n removeMemo(key) {\n if (this.memos[key] && this.memos[key].destroy) {\n this.memos[key].destroy();\n }\n\n delete this.memos[key];\n }\n\n /**\n * Some buttons need to change their visual style immediately once they get pressed\n */\n createInvokeHandlerAndUpdateState(namespace, value) {\n return (event) => {\n this.createInvokeHandler(namespace, value)(event);\n this.invoke('buttons.updateCurrentStyle');\n };\n }\n\n createInvokeHandler(namespace, value) {\n return (event) => {\n event.preventDefault();\n const $target = $(event.target);\n this.invoke(namespace, value || $target.closest('[data-value]').data('value'), $target);\n };\n }\n\n invoke() {\n const namespace = lists.head(arguments);\n const args = lists.tail(lists.from(arguments));\n\n const splits = namespace.split('.');\n const hasSeparator = splits.length > 1;\n const moduleName = hasSeparator && lists.head(splits);\n const methodName = hasSeparator ? lists.last(splits) : lists.head(splits);\n\n const module = this.modules[moduleName || 'editor'];\n if (!moduleName && this[methodName]) {\n return this[methodName].apply(this, args);\n } else if (module && module[methodName] && module.shouldInitialize()) {\n return module[methodName].apply(module, args);\n }\n }\n}\n","import $ from 'jquery';\nimport env from './env';\nimport func from './func';\nimport lists from './lists';\nimport dom from './dom';\n\n/**\n * return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js\n *\n * @param {TextRange} textRange\n * @param {Boolean} isStart\n * @return {BoundaryPoint}\n *\n * @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx\n */\nfunction textRangeToPoint(textRange, isStart) {\n let container = textRange.parentElement();\n let offset;\n\n const tester = document.body.createTextRange();\n let prevContainer;\n const childNodes = lists.from(container.childNodes);\n for (offset = 0; offset < childNodes.length; offset++) {\n if (dom.isText(childNodes[offset])) {\n continue;\n }\n tester.moveToElementText(childNodes[offset]);\n if (tester.compareEndPoints('StartToStart', textRange) >= 0) {\n break;\n }\n prevContainer = childNodes[offset];\n }\n\n if (offset !== 0 && dom.isText(childNodes[offset - 1])) {\n const textRangeStart = document.body.createTextRange();\n let curTextNode = null;\n textRangeStart.moveToElementText(prevContainer || container);\n textRangeStart.collapse(!prevContainer);\n curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild;\n\n const pointTester = textRange.duplicate();\n pointTester.setEndPoint('StartToStart', textRangeStart);\n let textCount = pointTester.text.replace(/[\\r\\n]/g, '').length;\n\n while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) {\n textCount -= curTextNode.nodeValue.length;\n curTextNode = curTextNode.nextSibling;\n }\n\n // [workaround] enforce IE to re-reference curTextNode, hack\n const dummy = curTextNode.nodeValue; // eslint-disable-line\n\n if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) &&\n textCount === curTextNode.nodeValue.length) {\n textCount -= curTextNode.nodeValue.length;\n curTextNode = curTextNode.nextSibling;\n }\n\n container = curTextNode;\n offset = textCount;\n }\n\n return {\n cont: container,\n offset: offset,\n };\n}\n\n/**\n * return TextRange from boundary point (inspired by google closure-library)\n * @param {BoundaryPoint} point\n * @return {TextRange}\n */\nfunction pointToTextRange(point) {\n const textRangeInfo = function(container, offset) {\n let node, isCollapseToStart;\n\n if (dom.isText(container)) {\n const prevTextNodes = dom.listPrev(container, func.not(dom.isText));\n const prevContainer = lists.last(prevTextNodes).previousSibling;\n node = prevContainer || container.parentNode;\n offset += lists.sum(lists.tail(prevTextNodes), dom.nodeLength);\n isCollapseToStart = !prevContainer;\n } else {\n node = container.childNodes[offset] || container;\n if (dom.isText(node)) {\n return textRangeInfo(node, 0);\n }\n\n offset = 0;\n isCollapseToStart = false;\n }\n\n return {\n node: node,\n collapseToStart: isCollapseToStart,\n offset: offset,\n };\n };\n\n const textRange = document.body.createTextRange();\n const info = textRangeInfo(point.node, point.offset);\n\n textRange.moveToElementText(info.node);\n textRange.collapse(info.collapseToStart);\n textRange.moveStart('character', info.offset);\n return textRange;\n}\n\n/**\n * Wrapped Range\n *\n * @constructor\n * @param {Node} sc - start container\n * @param {Number} so - start offset\n * @param {Node} ec - end container\n * @param {Number} eo - end offset\n */\nclass WrappedRange {\n constructor(sc, so, ec, eo) {\n this.sc = sc;\n this.so = so;\n this.ec = ec;\n this.eo = eo;\n\n // isOnEditable: judge whether range is on editable or not\n this.isOnEditable = this.makeIsOn(dom.isEditable);\n // isOnList: judge whether range is on list node or not\n this.isOnList = this.makeIsOn(dom.isList);\n // isOnAnchor: judge whether range is on anchor node or not\n this.isOnAnchor = this.makeIsOn(dom.isAnchor);\n // isOnCell: judge whether range is on cell node or not\n this.isOnCell = this.makeIsOn(dom.isCell);\n // isOnData: judge whether range is on data node or not\n this.isOnData = this.makeIsOn(dom.isData);\n }\n\n // nativeRange: get nativeRange from sc, so, ec, eo\n nativeRange() {\n if (env.isW3CRangeSupport) {\n const w3cRange = document.createRange();\n w3cRange.setStart(this.sc, this.sc.data && this.so > this.sc.data.length ? 0 : this.so);\n w3cRange.setEnd(this.ec, this.sc.data ? Math.min(this.eo, this.sc.data.length) : this.eo);\n\n return w3cRange;\n } else {\n const textRange = pointToTextRange({\n node: this.sc,\n offset: this.so,\n });\n\n textRange.setEndPoint('EndToEnd', pointToTextRange({\n node: this.ec,\n offset: this.eo,\n }));\n\n return textRange;\n }\n }\n\n getPoints() {\n return {\n sc: this.sc,\n so: this.so,\n ec: this.ec,\n eo: this.eo,\n };\n }\n\n getStartPoint() {\n return {\n node: this.sc,\n offset: this.so,\n };\n }\n\n getEndPoint() {\n return {\n node: this.ec,\n offset: this.eo,\n };\n }\n\n /**\n * select update visible range\n */\n select() {\n const nativeRng = this.nativeRange();\n if (env.isW3CRangeSupport) {\n const selection = document.getSelection();\n if (selection.rangeCount > 0) {\n selection.removeAllRanges();\n }\n selection.addRange(nativeRng);\n } else {\n nativeRng.select();\n }\n\n return this;\n }\n\n /**\n * Moves the scrollbar to start container(sc) of current range\n *\n * @return {WrappedRange}\n */\n scrollIntoView(container) {\n const height = $(container).height();\n if (container.scrollTop + height < this.sc.offsetTop) {\n container.scrollTop += Math.abs(container.scrollTop + height - this.sc.offsetTop);\n }\n\n return this;\n }\n\n /**\n * @return {WrappedRange}\n */\n normalize() {\n /**\n * @param {BoundaryPoint} point\n * @param {Boolean} isLeftToRight - true: prefer to choose right node\n * - false: prefer to choose left node\n * @return {BoundaryPoint}\n */\n const getVisiblePoint = function(point, isLeftToRight) {\n if (!point) {\n return point;\n }\n\n // Just use the given point [XXX:Adhoc]\n // - case 01. if the point is on the middle of the node\n // - case 02. if the point is on the right edge and prefer to choose left node\n // - case 03. if the point is on the left edge and prefer to choose right node\n // - case 04. if the point is on the right edge and prefer to choose right node but the node is void\n // - case 05. if the point is on the left edge and prefer to choose left node but the node is void\n // - case 06. if the point is on the block node and there is no children\n if (dom.isVisiblePoint(point)) {\n if (!dom.isEdgePoint(point) ||\n (dom.isRightEdgePoint(point) && !isLeftToRight) ||\n (dom.isLeftEdgePoint(point) && isLeftToRight) ||\n (dom.isRightEdgePoint(point) && isLeftToRight && dom.isVoid(point.node.nextSibling)) ||\n (dom.isLeftEdgePoint(point) && !isLeftToRight && dom.isVoid(point.node.previousSibling)) ||\n (dom.isBlock(point.node) && dom.isEmpty(point.node))) {\n return point;\n }\n }\n\n // point on block's edge\n const block = dom.ancestor(point.node, dom.isBlock);\n let hasRightNode = false;\n\n if (!hasRightNode) {\n const prevPoint = dom.prevPoint(point) || { node: null };\n hasRightNode = (dom.isLeftEdgePointOf(point, block) || dom.isVoid(prevPoint.node)) && !isLeftToRight;\n }\n\n let hasLeftNode = false;\n if (!hasLeftNode) {\n const nextPoint = dom.nextPoint(point) || { node: null };\n hasLeftNode = (dom.isRightEdgePointOf(point, block) || dom.isVoid(nextPoint.node)) && isLeftToRight;\n }\n\n if (hasRightNode || hasLeftNode) {\n // returns point already on visible point\n if (dom.isVisiblePoint(point)) {\n return point;\n }\n // reverse direction\n isLeftToRight = !isLeftToRight;\n }\n\n const nextPoint = isLeftToRight ? dom.nextPointUntil(dom.nextPoint(point), dom.isVisiblePoint)\n : dom.prevPointUntil(dom.prevPoint(point), dom.isVisiblePoint);\n return nextPoint || point;\n };\n\n const endPoint = getVisiblePoint(this.getEndPoint(), false);\n const startPoint = this.isCollapsed() ? endPoint : getVisiblePoint(this.getStartPoint(), true);\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns matched nodes on range\n *\n * @param {Function} [pred] - predicate function\n * @param {Object} [options]\n * @param {Boolean} [options.includeAncestor]\n * @param {Boolean} [options.fullyContains]\n * @return {Node[]}\n */\n nodes(pred, options) {\n pred = pred || func.ok;\n\n const includeAncestor = options && options.includeAncestor;\n const fullyContains = options && options.fullyContains;\n\n // TODO compare points and sort\n const startPoint = this.getStartPoint();\n const endPoint = this.getEndPoint();\n\n const nodes = [];\n const leftEdgeNodes = [];\n\n dom.walkPoint(startPoint, endPoint, function(point) {\n if (dom.isEditable(point.node)) {\n return;\n }\n\n let node;\n if (fullyContains) {\n if (dom.isLeftEdgePoint(point)) {\n leftEdgeNodes.push(point.node);\n }\n if (dom.isRightEdgePoint(point) && lists.contains(leftEdgeNodes, point.node)) {\n node = point.node;\n }\n } else if (includeAncestor) {\n node = dom.ancestor(point.node, pred);\n } else {\n node = point.node;\n }\n\n if (node && pred(node)) {\n nodes.push(node);\n }\n }, true);\n\n return lists.unique(nodes);\n }\n\n /**\n * returns commonAncestor of range\n * @return {Element} - commonAncestor\n */\n commonAncestor() {\n return dom.commonAncestor(this.sc, this.ec);\n }\n\n /**\n * returns expanded range by pred\n *\n * @param {Function} pred - predicate function\n * @return {WrappedRange}\n */\n expand(pred) {\n const startAncestor = dom.ancestor(this.sc, pred);\n const endAncestor = dom.ancestor(this.ec, pred);\n\n if (!startAncestor && !endAncestor) {\n return new WrappedRange(this.sc, this.so, this.ec, this.eo);\n }\n\n const boundaryPoints = this.getPoints();\n\n if (startAncestor) {\n boundaryPoints.sc = startAncestor;\n boundaryPoints.so = 0;\n }\n\n if (endAncestor) {\n boundaryPoints.ec = endAncestor;\n boundaryPoints.eo = dom.nodeLength(endAncestor);\n }\n\n return new WrappedRange(\n boundaryPoints.sc,\n boundaryPoints.so,\n boundaryPoints.ec,\n boundaryPoints.eo\n );\n }\n\n /**\n * @param {Boolean} isCollapseToStart\n * @return {WrappedRange}\n */\n collapse(isCollapseToStart) {\n if (isCollapseToStart) {\n return new WrappedRange(this.sc, this.so, this.sc, this.so);\n } else {\n return new WrappedRange(this.ec, this.eo, this.ec, this.eo);\n }\n }\n\n /**\n * splitText on range\n */\n splitText() {\n const isSameContainer = this.sc === this.ec;\n const boundaryPoints = this.getPoints();\n\n if (dom.isText(this.ec) && !dom.isEdgePoint(this.getEndPoint())) {\n this.ec.splitText(this.eo);\n }\n\n if (dom.isText(this.sc) && !dom.isEdgePoint(this.getStartPoint())) {\n boundaryPoints.sc = this.sc.splitText(this.so);\n boundaryPoints.so = 0;\n\n if (isSameContainer) {\n boundaryPoints.ec = boundaryPoints.sc;\n boundaryPoints.eo = this.eo - this.so;\n }\n }\n\n return new WrappedRange(\n boundaryPoints.sc,\n boundaryPoints.so,\n boundaryPoints.ec,\n boundaryPoints.eo\n );\n }\n\n /**\n * delete contents on range\n * @return {WrappedRange}\n */\n deleteContents() {\n if (this.isCollapsed()) {\n return this;\n }\n\n const rng = this.splitText();\n const nodes = rng.nodes(null, {\n fullyContains: true,\n });\n\n // find new cursor point\n const point = dom.prevPointUntil(rng.getStartPoint(), function(point) {\n return !lists.contains(nodes, point.node);\n });\n\n const emptyParents = [];\n $.each(nodes, function(idx, node) {\n // find empty parents\n const parent = node.parentNode;\n if (point.node !== parent && dom.nodeLength(parent) === 1) {\n emptyParents.push(parent);\n }\n dom.remove(node, false);\n });\n\n // remove empty parents\n $.each(emptyParents, function(idx, node) {\n dom.remove(node, false);\n });\n\n return new WrappedRange(\n point.node,\n point.offset,\n point.node,\n point.offset\n ).normalize();\n }\n\n /**\n * makeIsOn: return isOn(pred) function\n */\n makeIsOn(pred) {\n return function() {\n const ancestor = dom.ancestor(this.sc, pred);\n return !!ancestor && (ancestor === dom.ancestor(this.ec, pred));\n };\n }\n\n /**\n * @param {Function} pred\n * @return {Boolean}\n */\n isLeftEdgeOf(pred) {\n if (!dom.isLeftEdgePoint(this.getStartPoint())) {\n return false;\n }\n\n const node = dom.ancestor(this.sc, pred);\n return node && dom.isLeftEdgeOf(this.sc, node);\n }\n\n /**\n * returns whether range was collapsed or not\n */\n isCollapsed() {\n return this.sc === this.ec && this.so === this.eo;\n }\n\n /**\n * wrap inline nodes which children of body with paragraph\n *\n * @return {WrappedRange}\n */\n wrapBodyInlineWithPara() {\n if (dom.isBodyContainer(this.sc) && dom.isEmpty(this.sc)) {\n this.sc.innerHTML = dom.emptyPara;\n return new WrappedRange(this.sc.firstChild, 0, this.sc.firstChild, 0);\n }\n\n /**\n * [workaround] firefox often create range on not visible point. so normalize here.\n * - firefox: |<p>text</p>|\n * - chrome: <p>|text|</p>\n */\n const rng = this.normalize();\n if (dom.isParaInline(this.sc) || dom.isPara(this.sc)) {\n return rng;\n }\n\n // find inline top ancestor\n let topAncestor;\n if (dom.isInline(rng.sc)) {\n const ancestors = dom.listAncestor(rng.sc, func.not(dom.isInline));\n topAncestor = lists.last(ancestors);\n if (!dom.isInline(topAncestor)) {\n topAncestor = ancestors[ancestors.length - 2] || rng.sc.childNodes[rng.so];\n }\n } else {\n topAncestor = rng.sc.childNodes[rng.so > 0 ? rng.so - 1 : 0];\n }\n\n if (topAncestor) {\n // siblings not in paragraph\n let inlineSiblings = dom.listPrev(topAncestor, dom.isParaInline).reverse();\n inlineSiblings = inlineSiblings.concat(dom.listNext(topAncestor.nextSibling, dom.isParaInline));\n\n // wrap with paragraph\n if (inlineSiblings.length) {\n const para = dom.wrap(lists.head(inlineSiblings), 'p');\n dom.appendChildNodes(para, lists.tail(inlineSiblings));\n }\n }\n\n return this.normalize();\n }\n\n /**\n * insert node at current cursor\n *\n * @param {Node} node\n * @return {Node}\n */\n insertNode(node) {\n let rng = this;\n\n if (dom.isText(node) || dom.isInline(node)) {\n rng = this.wrapBodyInlineWithPara().deleteContents();\n }\n\n const info = dom.splitPoint(rng.getStartPoint(), dom.isInline(node));\n if (info.rightNode) {\n info.rightNode.parentNode.insertBefore(node, info.rightNode);\n } else {\n info.container.appendChild(node);\n }\n\n return node;\n }\n\n /**\n * insert html at current cursor\n */\n pasteHTML(markup) {\n markup = $.trim(markup);\n\n const contentsContainer = $('<div></div>').html(markup)[0];\n let childNodes = lists.from(contentsContainer.childNodes);\n\n // const rng = this.wrapBodyInlineWithPara().deleteContents();\n const rng = this;\n\n if (rng.so >= 0) {\n childNodes = childNodes.reverse();\n }\n childNodes = childNodes.map(function(childNode) {\n return rng.insertNode(childNode);\n });\n if (rng.so > 0) {\n childNodes = childNodes.reverse();\n }\n return childNodes;\n }\n\n /**\n * returns text in range\n *\n * @return {String}\n */\n toString() {\n const nativeRng = this.nativeRange();\n return env.isW3CRangeSupport ? nativeRng.toString() : nativeRng.text;\n }\n\n /**\n * returns range for word before cursor\n *\n * @param {Boolean} [findAfter] - find after cursor, default: false\n * @return {WrappedRange}\n */\n getWordRange(findAfter) {\n let endPoint = this.getEndPoint();\n\n if (!dom.isCharPoint(endPoint)) {\n return this;\n }\n\n const startPoint = dom.prevPointUntil(endPoint, function(point) {\n return !dom.isCharPoint(point);\n });\n\n if (findAfter) {\n endPoint = dom.nextPointUntil(endPoint, function(point) {\n return !dom.isCharPoint(point);\n });\n }\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns range for words before cursor\n *\n * @param {Boolean} [findAfter] - find after cursor, default: false\n * @return {WrappedRange}\n */\n getWordsRange(findAfter) {\n var endPoint = this.getEndPoint();\n\n var isNotTextPoint = function(point) {\n return !dom.isCharPoint(point) && !dom.isSpacePoint(point);\n };\n\n if (isNotTextPoint(endPoint)) {\n return this;\n }\n\n var startPoint = dom.prevPointUntil(endPoint, isNotTextPoint);\n\n if (findAfter) {\n endPoint = dom.nextPointUntil(endPoint, isNotTextPoint);\n }\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns range for words before cursor that match with a Regex\n *\n * example:\n * range: 'hi @Peter Pan'\n * regex: '/@[a-z ]+/i'\n * return range: '@Peter Pan'\n *\n * @param {RegExp} [regex]\n * @return {WrappedRange|null}\n */\n getWordsMatchRange(regex) {\n var endPoint = this.getEndPoint();\n\n var startPoint = dom.prevPointUntil(endPoint, function(point) {\n if (!dom.isCharPoint(point) && !dom.isSpacePoint(point)) {\n return true;\n }\n var rng = new WrappedRange(\n point.node,\n point.offset,\n endPoint.node,\n endPoint.offset\n );\n var result = regex.exec(rng.toString());\n return result && result.index === 0;\n });\n\n var rng = new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n\n var text = rng.toString();\n var result = regex.exec(text);\n\n if (result && result[0].length === text.length) {\n return rng;\n } else {\n return null;\n }\n }\n\n /**\n * create offsetPath bookmark\n *\n * @param {Node} editable\n */\n bookmark(editable) {\n return {\n s: {\n path: dom.makeOffsetPath(editable, this.sc),\n offset: this.so,\n },\n e: {\n path: dom.makeOffsetPath(editable, this.ec),\n offset: this.eo,\n },\n };\n }\n\n /**\n * create offsetPath bookmark base on paragraph\n *\n * @param {Node[]} paras\n */\n paraBookmark(paras) {\n return {\n s: {\n path: lists.tail(dom.makeOffsetPath(lists.head(paras), this.sc)),\n offset: this.so,\n },\n e: {\n path: lists.tail(dom.makeOffsetPath(lists.last(paras), this.ec)),\n offset: this.eo,\n },\n };\n }\n\n /**\n * getClientRects\n * @return {Rect[]}\n */\n getClientRects() {\n const nativeRng = this.nativeRange();\n return nativeRng.getClientRects();\n }\n}\n\n/**\n * Data structure\n * * BoundaryPoint: a point of dom tree\n * * BoundaryPoints: two boundaryPoints corresponding to the start and the end of the Range\n *\n * See to http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Position\n */\nexport default {\n /**\n * create Range Object From arguments or Browser Selection\n *\n * @param {Node} sc - start container\n * @param {Number} so - start offset\n * @param {Node} ec - end container\n * @param {Number} eo - end offset\n * @return {WrappedRange}\n */\n create: function(sc, so, ec, eo) {\n if (arguments.length === 4) {\n return new WrappedRange(sc, so, ec, eo);\n } else if (arguments.length === 2) { // collapsed\n ec = sc;\n eo = so;\n return new WrappedRange(sc, so, ec, eo);\n } else {\n let wrappedRange = this.createFromSelection();\n\n if (!wrappedRange && arguments.length === 1) {\n let bodyElement = arguments[0];\n if (dom.isEditable(bodyElement)) {\n bodyElement = bodyElement.lastChild;\n }\n return this.createFromBodyElement(bodyElement, dom.emptyPara === arguments[0].innerHTML);\n }\n return wrappedRange;\n }\n },\n\n createFromBodyElement: function(bodyElement, isCollapseToStart = false) {\n var wrappedRange = this.createFromNode(bodyElement);\n return wrappedRange.collapse(isCollapseToStart);\n },\n\n createFromSelection: function() {\n let sc, so, ec, eo;\n if (env.isW3CRangeSupport) {\n const selection = document.getSelection();\n if (!selection || selection.rangeCount === 0) {\n return null;\n } else if (dom.isBody(selection.anchorNode)) {\n // Firefox: returns entire body as range on initialization.\n // We won't never need it.\n return null;\n }\n\n const nativeRng = selection.getRangeAt(0);\n sc = nativeRng.startContainer;\n so = nativeRng.startOffset;\n ec = nativeRng.endContainer;\n eo = nativeRng.endOffset;\n } else { // IE8: TextRange\n const textRange = document.selection.createRange();\n const textRangeEnd = textRange.duplicate();\n textRangeEnd.collapse(false);\n const textRangeStart = textRange;\n textRangeStart.collapse(true);\n\n let startPoint = textRangeToPoint(textRangeStart, true);\n let endPoint = textRangeToPoint(textRangeEnd, false);\n\n // same visible point case: range was collapsed.\n if (dom.isText(startPoint.node) && dom.isLeftEdgePoint(startPoint) &&\n dom.isTextNode(endPoint.node) && dom.isRightEdgePoint(endPoint) &&\n endPoint.node.nextSibling === startPoint.node) {\n startPoint = endPoint;\n }\n\n sc = startPoint.cont;\n so = startPoint.offset;\n ec = endPoint.cont;\n eo = endPoint.offset;\n }\n\n return new WrappedRange(sc, so, ec, eo);\n },\n\n /**\n * @method\n *\n * create WrappedRange from node\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNode: function(node) {\n let sc = node;\n let so = 0;\n let ec = node;\n let eo = dom.nodeLength(ec);\n\n // browsers can't target a picture or void node\n if (dom.isVoid(sc)) {\n so = dom.listPrev(sc).length - 1;\n sc = sc.parentNode;\n }\n if (dom.isBR(ec)) {\n eo = dom.listPrev(ec).length - 1;\n ec = ec.parentNode;\n } else if (dom.isVoid(ec)) {\n eo = dom.listPrev(ec).length;\n ec = ec.parentNode;\n }\n\n return this.create(sc, so, ec, eo);\n },\n\n /**\n * create WrappedRange from node after position\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNodeBefore: function(node) {\n return this.createFromNode(node).collapse(true);\n },\n\n /**\n * create WrappedRange from node after position\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNodeAfter: function(node) {\n return this.createFromNode(node).collapse();\n },\n\n /**\n * @method\n *\n * create WrappedRange from bookmark\n *\n * @param {Node} editable\n * @param {Object} bookmark\n * @return {WrappedRange}\n */\n createFromBookmark: function(editable, bookmark) {\n const sc = dom.fromOffsetPath(editable, bookmark.s.path);\n const so = bookmark.s.offset;\n const ec = dom.fromOffsetPath(editable, bookmark.e.path);\n const eo = bookmark.e.offset;\n return new WrappedRange(sc, so, ec, eo);\n },\n\n /**\n * @method\n *\n * create WrappedRange from paraBookmark\n *\n * @param {Object} bookmark\n * @param {Node[]} paras\n * @return {WrappedRange}\n */\n createFromParaBookmark: function(bookmark, paras) {\n const so = bookmark.s.offset;\n const eo = bookmark.e.offset;\n const sc = dom.fromOffsetPath(lists.head(paras), bookmark.s.path);\n const ec = dom.fromOffsetPath(lists.last(paras), bookmark.e.path);\n\n return new WrappedRange(sc, so, ec, eo);\n },\n};\n","import $ from 'jquery';\nimport env from './base/core/env';\nimport lists from './base/core/lists';\nimport Context from './base/Context';\n\n$.fn.extend({\n /**\n * Summernote API\n *\n * @param {Object|String}\n * @return {this}\n */\n summernote: function() {\n const type = $.type(lists.head(arguments));\n const isExternalAPICalled = type === 'string';\n const hasInitOptions = type === 'object';\n\n const options = $.extend({}, $.summernote.options, hasInitOptions ? lists.head(arguments) : {});\n\n // Update options\n options.langInfo = $.extend(true, {}, $.summernote.lang['en-US'], $.summernote.lang[options.lang]);\n options.icons = $.extend(true, {}, $.summernote.options.icons, options.icons);\n options.tooltip = options.tooltip === 'auto' ? !env.isSupportTouch : options.tooltip;\n\n this.each((idx, note) => {\n const $note = $(note);\n if (!$note.data('summernote')) {\n const context = new Context($note, options);\n $note.data('summernote', context);\n $note.data('summernote').triggerEvent('init', context.layoutInfo);\n }\n });\n\n const $note = this.first();\n if ($note.length) {\n const context = $note.data('summernote');\n if (isExternalAPICalled) {\n return context.invoke.apply(context, lists.from(arguments));\n } else if (options.focus) {\n context.invoke('editor.focus');\n }\n }\n\n return this;\n },\n});\n","import lists from './lists';\nimport func from './func';\n\nconst KEY_MAP = {\n 'BACKSPACE': 8,\n 'TAB': 9,\n 'ENTER': 13,\n 'SPACE': 32,\n 'DELETE': 46,\n\n // Arrow\n 'LEFT': 37,\n 'UP': 38,\n 'RIGHT': 39,\n 'DOWN': 40,\n\n // Number: 0-9\n 'NUM0': 48,\n 'NUM1': 49,\n 'NUM2': 50,\n 'NUM3': 51,\n 'NUM4': 52,\n 'NUM5': 53,\n 'NUM6': 54,\n 'NUM7': 55,\n 'NUM8': 56,\n\n // Alphabet: a-z\n 'B': 66,\n 'E': 69,\n 'I': 73,\n 'J': 74,\n 'K': 75,\n 'L': 76,\n 'R': 82,\n 'S': 83,\n 'U': 85,\n 'V': 86,\n 'Y': 89,\n 'Z': 90,\n\n 'SLASH': 191,\n 'LEFTBRACKET': 219,\n 'BACKSLASH': 220,\n 'RIGHTBRACKET': 221,\n\n // Navigation\n 'HOME': 36,\n 'END': 35,\n 'PAGEUP': 33,\n 'PAGEDOWN': 34,\n};\n\n/**\n * @class core.key\n *\n * Object for keycodes.\n *\n * @singleton\n * @alternateClassName key\n */\nexport default {\n /**\n * @method isEdit\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isEdit: (keyCode) => {\n return lists.contains([\n KEY_MAP.BACKSPACE,\n KEY_MAP.TAB,\n KEY_MAP.ENTER,\n KEY_MAP.SPACE,\n KEY_MAP.DELETE,\n ], keyCode);\n },\n /**\n * @method isMove\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isMove: (keyCode) => {\n return lists.contains([\n KEY_MAP.LEFT,\n KEY_MAP.UP,\n KEY_MAP.RIGHT,\n KEY_MAP.DOWN,\n ], keyCode);\n },\n /**\n * @method isNavigation\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isNavigation: (keyCode) => {\n return lists.contains([\n KEY_MAP.HOME,\n KEY_MAP.END,\n KEY_MAP.PAGEUP,\n KEY_MAP.PAGEDOWN,\n ], keyCode);\n },\n /**\n * @property {Object} nameFromCode\n * @property {String} nameFromCode.8 \"BACKSPACE\"\n */\n nameFromCode: func.invertObject(KEY_MAP),\n code: KEY_MAP,\n};\n","import range from '../core/range';\n\nexport default class History {\n constructor(context) {\n this.stack = [];\n this.stackOffset = -1;\n this.context = context;\n this.$editable = context.layoutInfo.editable;\n this.editable = this.$editable[0];\n }\n\n makeSnapshot() {\n const rng = range.create(this.editable);\n const emptyBookmark = { s: { path: [], offset: 0 }, e: { path: [], offset: 0 } };\n\n return {\n contents: this.$editable.html(),\n bookmark: ((rng && rng.isOnEditable()) ? rng.bookmark(this.editable) : emptyBookmark),\n };\n }\n\n applySnapshot(snapshot) {\n if (snapshot.contents !== null) {\n this.$editable.html(snapshot.contents);\n }\n if (snapshot.bookmark !== null) {\n range.createFromBookmark(this.editable, snapshot.bookmark).select();\n }\n }\n\n /**\n * @method rewind\n * Rewinds the history stack back to the first snapshot taken.\n * Leaves the stack intact, so that \"Redo\" can still be used.\n */\n rewind() {\n // Create snap shot if not yet recorded\n if (this.$editable.html() !== this.stack[this.stackOffset].contents) {\n this.recordUndo();\n }\n\n // Return to the first available snapshot.\n this.stackOffset = 0;\n\n // Apply that snapshot.\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n\n /**\n * @method commit\n * Resets history stack, but keeps current editor's content.\n */\n commit() {\n // Clear the stack.\n this.stack = [];\n\n // Restore stackOffset to its original value.\n this.stackOffset = -1;\n\n // Record our first snapshot (of nothing).\n this.recordUndo();\n }\n\n /**\n * @method reset\n * Resets the history stack completely; reverting to an empty editor.\n */\n reset() {\n // Clear the stack.\n this.stack = [];\n\n // Restore stackOffset to its original value.\n this.stackOffset = -1;\n\n // Clear the editable area.\n this.$editable.html('');\n\n // Record our first snapshot (of nothing).\n this.recordUndo();\n }\n\n /**\n * undo\n */\n undo() {\n // Create snap shot if not yet recorded\n if (this.$editable.html() !== this.stack[this.stackOffset].contents) {\n this.recordUndo();\n }\n\n if (this.stackOffset > 0) {\n this.stackOffset--;\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n }\n\n /**\n * redo\n */\n redo() {\n if (this.stack.length - 1 > this.stackOffset) {\n this.stackOffset++;\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n }\n\n /**\n * recorded undo\n */\n recordUndo() {\n this.stackOffset++;\n\n // Wash out stack after stackOffset\n if (this.stack.length > this.stackOffset) {\n this.stack = this.stack.slice(0, this.stackOffset);\n }\n\n // Create new snapshot and push it to the end\n this.stack.push(this.makeSnapshot());\n\n // If the stack size reachs to the limit, then slice it\n if (this.stack.length > this.context.options.historyLimit) {\n this.stack.shift();\n this.stackOffset -= 1;\n }\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class Style {\n /**\n * @method jQueryCSS\n *\n * [workaround] for old jQuery\n * passing an array of style properties to .css()\n * will result in an object of property-value pairs.\n * (compability with version < 1.9)\n *\n * @private\n * @param {jQuery} $obj\n * @param {Array} propertyNames - An array of one or more CSS properties.\n * @return {Object}\n */\n jQueryCSS($obj, propertyNames) {\n if (env.jqueryVersion < 1.9) {\n const result = {};\n $.each(propertyNames, (idx, propertyName) => {\n result[propertyName] = $obj.css(propertyName);\n });\n return result;\n }\n return $obj.css(propertyNames);\n }\n\n /**\n * returns style object from node\n *\n * @param {jQuery} $node\n * @return {Object}\n */\n fromNode($node) {\n const properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];\n const styleInfo = this.jQueryCSS($node, properties) || {};\n\n const fontSize = $node[0].style.fontSize || styleInfo['font-size'];\n\n styleInfo['font-size'] = parseInt(fontSize, 10);\n styleInfo['font-size-unit'] = fontSize.match(/[a-z%]+$/);\n\n return styleInfo;\n }\n\n /**\n * paragraph level style\n *\n * @param {WrappedRange} rng\n * @param {Object} styleInfo\n */\n stylePara(rng, styleInfo) {\n $.each(rng.nodes(dom.isPara, {\n includeAncestor: true,\n }), (idx, para) => {\n $(para).css(styleInfo);\n });\n }\n\n /**\n * insert and returns styleNodes on range.\n *\n * @param {WrappedRange} rng\n * @param {Object} [options] - options for styleNodes\n * @param {String} [options.nodeName] - default: `SPAN`\n * @param {Boolean} [options.expandClosestSibling] - default: `false`\n * @param {Boolean} [options.onlyPartialContains] - default: `false`\n * @return {Node[]}\n */\n styleNodes(rng, options) {\n rng = rng.splitText();\n\n const nodeName = (options && options.nodeName) || 'SPAN';\n const expandClosestSibling = !!(options && options.expandClosestSibling);\n const onlyPartialContains = !!(options && options.onlyPartialContains);\n\n if (rng.isCollapsed()) {\n return [rng.insertNode(dom.create(nodeName))];\n }\n\n let pred = dom.makePredByNodeName(nodeName);\n const nodes = rng.nodes(dom.isText, {\n fullyContains: true,\n }).map((text) => {\n return dom.singleChildAncestor(text, pred) || dom.wrap(text, nodeName);\n });\n\n if (expandClosestSibling) {\n if (onlyPartialContains) {\n const nodesInRange = rng.nodes();\n // compose with partial contains predication\n pred = func.and(pred, (node) => {\n return lists.contains(nodesInRange, node);\n });\n }\n\n return nodes.map((node) => {\n const siblings = dom.withClosestSiblings(node, pred);\n const head = lists.head(siblings);\n const tails = lists.tail(siblings);\n $.each(tails, (idx, elem) => {\n dom.appendChildNodes(head, elem.childNodes);\n dom.remove(elem);\n });\n return lists.head(siblings);\n });\n } else {\n return nodes;\n }\n }\n\n /**\n * get current style on cursor\n *\n * @param {WrappedRange} rng\n * @return {Object} - object contains style properties.\n */\n current(rng) {\n const $cont = $(!dom.isElement(rng.sc) ? rng.sc.parentNode : rng.sc);\n let styleInfo = this.fromNode($cont);\n\n // document.queryCommandState for toggle state\n // [workaround] prevent Firefox nsresult: \"0x80004005 (NS_ERROR_FAILURE)\"\n try {\n styleInfo = $.extend(styleInfo, {\n 'font-bold': document.queryCommandState('bold') ? 'bold' : 'normal',\n 'font-italic': document.queryCommandState('italic') ? 'italic' : 'normal',\n 'font-underline': document.queryCommandState('underline') ? 'underline' : 'normal',\n 'font-subscript': document.queryCommandState('subscript') ? 'subscript' : 'normal',\n 'font-superscript': document.queryCommandState('superscript') ? 'superscript' : 'normal',\n 'font-strikethrough': document.queryCommandState('strikethrough') ? 'strikethrough' : 'normal',\n 'font-family': document.queryCommandValue('fontname') || styleInfo['font-family'],\n });\n } catch (e) {\n // eslint-disable-next-line\n }\n\n // list-style-type to list-style(unordered, ordered)\n if (!rng.isOnList()) {\n styleInfo['list-style'] = 'none';\n } else {\n const orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square'];\n const isUnordered = orderedTypes.indexOf(styleInfo['list-style-type']) > -1;\n styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered';\n }\n\n const para = dom.ancestor(rng.sc, dom.isPara);\n if (para && para.style['line-height']) {\n styleInfo['line-height'] = para.style.lineHeight;\n } else {\n const lineHeight = parseInt(styleInfo['line-height'], 10) / parseInt(styleInfo['font-size'], 10);\n styleInfo['line-height'] = lineHeight.toFixed(1);\n }\n\n styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor);\n styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable);\n styleInfo.range = rng;\n\n return styleInfo;\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport func from '../core/func';\nimport dom from '../core/dom';\nimport range from '../core/range';\n\nexport default class Bullet {\n /**\n * toggle ordered list\n */\n insertOrderedList(editable) {\n this.toggleList('OL', editable);\n }\n\n /**\n * toggle unordered list\n */\n insertUnorderedList(editable) {\n this.toggleList('UL', editable);\n }\n\n /**\n * indent\n */\n indent(editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n\n const paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n if (dom.isLi(head)) {\n const previousList = this.findList(head.previousSibling);\n if (previousList) {\n paras\n .map(para => previousList.appendChild(para));\n } else {\n this.wrapList(paras, head.parentNode.nodeName);\n paras\n .map((para) => para.parentNode)\n .map((para) => this.appendToPrevious(para));\n }\n } else {\n $.each(paras, (idx, para) => {\n $(para).css('marginLeft', (idx, val) => {\n return (parseInt(val, 10) || 0) + 25;\n });\n });\n }\n });\n\n rng.select();\n }\n\n /**\n * outdent\n */\n outdent(editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n\n const paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n if (dom.isLi(head)) {\n this.releaseList([paras]);\n } else {\n $.each(paras, (idx, para) => {\n $(para).css('marginLeft', (idx, val) => {\n val = (parseInt(val, 10) || 0);\n return val > 25 ? val - 25 : '';\n });\n });\n }\n });\n\n rng.select();\n }\n\n /**\n * toggle list\n *\n * @param {String} listName - OL or UL\n */\n toggleList(listName, editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n\n let paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const bookmark = rng.paraBookmark(paras);\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n // paragraph to list\n if (lists.find(paras, dom.isPurePara)) {\n let wrappedParas = [];\n $.each(clustereds, (idx, paras) => {\n wrappedParas = wrappedParas.concat(this.wrapList(paras, listName));\n });\n paras = wrappedParas;\n // list to paragraph or change list style\n } else {\n const diffLists = rng.nodes(dom.isList, {\n includeAncestor: true,\n }).filter((listNode) => {\n return !$.nodeName(listNode, listName);\n });\n\n if (diffLists.length) {\n $.each(diffLists, (idx, listNode) => {\n dom.replace(listNode, listName);\n });\n } else {\n paras = this.releaseList(clustereds, true);\n }\n }\n\n range.createFromParaBookmark(bookmark, paras).select();\n }\n\n /**\n * @param {Node[]} paras\n * @param {String} listName\n * @return {Node[]}\n */\n wrapList(paras, listName) {\n const head = lists.head(paras);\n const last = lists.last(paras);\n\n const prevList = dom.isList(head.previousSibling) && head.previousSibling;\n const nextList = dom.isList(last.nextSibling) && last.nextSibling;\n\n const listNode = prevList || dom.insertAfter(dom.create(listName || 'UL'), last);\n\n // P to LI\n paras = paras.map((para) => {\n return dom.isPurePara(para) ? dom.replace(para, 'LI') : para;\n });\n\n // append to list(<ul>, <ol>)\n dom.appendChildNodes(listNode, paras);\n\n if (nextList) {\n dom.appendChildNodes(listNode, lists.from(nextList.childNodes));\n dom.remove(nextList);\n }\n\n return paras;\n }\n\n /**\n * @method releaseList\n *\n * @param {Array[]} clustereds\n * @param {Boolean} isEscapseToBody\n * @return {Node[]}\n */\n releaseList(clustereds, isEscapseToBody) {\n let releasedParas = [];\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n const last = lists.last(paras);\n\n const headList = isEscapseToBody ? dom.lastAncestor(head, dom.isList) : head.parentNode;\n const parentItem = headList.parentNode;\n\n if (headList.parentNode.nodeName === 'LI') {\n paras.map(para => {\n const newList = this.findNextSiblings(para);\n\n if (parentItem.nextSibling) {\n parentItem.parentNode.insertBefore(\n para,\n parentItem.nextSibling\n );\n } else {\n parentItem.parentNode.appendChild(para);\n }\n\n if (newList.length) {\n this.wrapList(newList, headList.nodeName);\n para.appendChild(newList[0].parentNode);\n }\n });\n\n if (headList.children.length === 0) {\n parentItem.removeChild(headList);\n }\n\n if (parentItem.childNodes.length === 0) {\n parentItem.parentNode.removeChild(parentItem);\n }\n } else {\n const lastList = headList.childNodes.length > 1 ? dom.splitTree(headList, {\n node: last.parentNode,\n offset: dom.position(last) + 1,\n }, {\n isSkipPaddingBlankHTML: true,\n }) : null;\n\n const middleList = dom.splitTree(headList, {\n node: head.parentNode,\n offset: dom.position(head),\n }, {\n isSkipPaddingBlankHTML: true,\n });\n\n paras = isEscapseToBody ? dom.listDescendant(middleList, dom.isLi)\n : lists.from(middleList.childNodes).filter(dom.isLi);\n\n // LI to P\n if (isEscapseToBody || !dom.isList(headList.parentNode)) {\n paras = paras.map((para) => {\n return dom.replace(para, 'P');\n });\n }\n\n $.each(lists.from(paras).reverse(), (idx, para) => {\n dom.insertAfter(para, headList);\n });\n\n // remove empty lists\n const rootLists = lists.compact([headList, middleList, lastList]);\n $.each(rootLists, (idx, rootList) => {\n const listNodes = [rootList].concat(dom.listDescendant(rootList, dom.isList));\n $.each(listNodes.reverse(), (idx, listNode) => {\n if (!dom.nodeLength(listNode)) {\n dom.remove(listNode, true);\n }\n });\n });\n }\n\n releasedParas = releasedParas.concat(paras);\n });\n\n return releasedParas;\n }\n\n /**\n * @method appendToPrevious\n *\n * Appends list to previous list item, if\n * none exist it wraps the list in a new list item.\n *\n * @param {HTMLNode} ListItem\n * @return {HTMLNode}\n */\n appendToPrevious(node) {\n return node.previousSibling\n ? dom.appendChildNodes(node.previousSibling, [node])\n : this.wrapList([node], 'LI');\n }\n\n /**\n * @method findList\n *\n * Finds an existing list in list item\n *\n * @param {HTMLNode} ListItem\n * @return {Array[]}\n */\n findList(node) {\n return node\n ? lists.find(node.children, child => ['OL', 'UL'].indexOf(child.nodeName) > -1)\n : null;\n }\n\n /**\n * @method findNextSiblings\n *\n * Finds all list item siblings that follow it\n *\n * @param {HTMLNode} ListItem\n * @return {HTMLNode}\n */\n findNextSiblings(node) {\n const siblings = [];\n while (node.nextSibling) {\n siblings.push(node.nextSibling);\n node = node.nextSibling;\n }\n return siblings;\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport Bullet from '../editing/Bullet';\n\n/**\n * @class editing.Typing\n *\n * Typing\n *\n */\nexport default class Typing {\n constructor(context) {\n // a Bullet instance to toggle lists off\n this.bullet = new Bullet();\n this.options = context.options;\n }\n\n /**\n * insert tab\n *\n * @param {WrappedRange} rng\n * @param {Number} tabsize\n */\n insertTab(rng, tabsize) {\n const tab = dom.createText(new Array(tabsize + 1).join(dom.NBSP_CHAR));\n rng = rng.deleteContents();\n rng.insertNode(tab, true);\n\n rng = range.create(tab, tabsize);\n rng.select();\n }\n\n /**\n * insert paragraph\n *\n * @param {jQuery} $editable\n * @param {WrappedRange} rng Can be used in unit tests to \"mock\" the range\n *\n * blockquoteBreakingLevel\n * 0 - No break, the new paragraph remains inside the quote\n * 1 - Break the first blockquote in the ancestors list\n * 2 - Break all blockquotes, so that the new paragraph is not quoted (this is the default)\n */\n insertParagraph(editable, rng) {\n rng = rng || range.create(editable);\n\n // deleteContents on range.\n rng = rng.deleteContents();\n\n // Wrap range if it needs to be wrapped by paragraph\n rng = rng.wrapBodyInlineWithPara();\n\n // finding paragraph\n const splitRoot = dom.ancestor(rng.sc, dom.isPara);\n\n let nextPara;\n // on paragraph: split paragraph\n if (splitRoot) {\n // if it is an empty line with li\n if (dom.isLi(splitRoot) && (dom.isEmpty(splitRoot) || dom.deepestChildIsEmpty(splitRoot))) {\n // toogle UL/OL and escape\n this.bullet.toggleList(splitRoot.parentNode.nodeName);\n return;\n } else {\n let blockquote = null;\n if (this.options.blockquoteBreakingLevel === 1) {\n blockquote = dom.ancestor(splitRoot, dom.isBlockquote);\n } else if (this.options.blockquoteBreakingLevel === 2) {\n blockquote = dom.lastAncestor(splitRoot, dom.isBlockquote);\n }\n\n if (blockquote) {\n // We're inside a blockquote and options ask us to break it\n nextPara = $(dom.emptyPara)[0];\n // If the split is right before a <br>, remove it so that there's no \"empty line\"\n // after the split in the new blockquote created\n if (dom.isRightEdgePoint(rng.getStartPoint()) && dom.isBR(rng.sc.nextSibling)) {\n $(rng.sc.nextSibling).remove();\n }\n const split = dom.splitTree(blockquote, rng.getStartPoint(), { isDiscardEmptySplits: true });\n if (split) {\n split.parentNode.insertBefore(nextPara, split);\n } else {\n dom.insertAfter(nextPara, blockquote); // There's no split if we were at the end of the blockquote\n }\n } else {\n nextPara = dom.splitTree(splitRoot, rng.getStartPoint());\n\n // not a blockquote, just insert the paragraph\n let emptyAnchors = dom.listDescendant(splitRoot, dom.isEmptyAnchor);\n emptyAnchors = emptyAnchors.concat(dom.listDescendant(nextPara, dom.isEmptyAnchor));\n\n $.each(emptyAnchors, (idx, anchor) => {\n dom.remove(anchor);\n });\n\n // replace empty heading, pre or custom-made styleTag with P tag\n if ((dom.isHeading(nextPara) || dom.isPre(nextPara) || dom.isCustomStyleTag(nextPara)) && dom.isEmpty(nextPara)) {\n nextPara = dom.replace(nextPara, 'p');\n }\n }\n }\n // no paragraph: insert empty paragraph\n } else {\n const next = rng.sc.childNodes[rng.so];\n nextPara = $(dom.emptyPara)[0];\n if (next) {\n rng.sc.insertBefore(nextPara, next);\n } else {\n rng.sc.appendChild(nextPara);\n }\n }\n\n range.create(nextPara, 0).normalize().select().scrollIntoView(editable);\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport lists from '../core/lists';\n\n/**\n * @class Create a virtual table to create what actions to do in change.\n * @param {object} startPoint Cell selected to apply change.\n * @param {enum} where Where change will be applied Row or Col. Use enum: TableResultAction.where\n * @param {enum} action Action to be applied. Use enum: TableResultAction.requestAction\n * @param {object} domTable Dom element of table to make changes.\n */\nconst TableResultAction = function(startPoint, where, action, domTable) {\n const _startPoint = { 'colPos': 0, 'rowPos': 0 };\n const _virtualTable = [];\n const _actionCellList = [];\n\n /// ///////////////////////////////////////////\n // Private functions\n /// ///////////////////////////////////////////\n\n /**\n * Set the startPoint of action.\n */\n function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n // Impossible to identify start Cell point\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n // Impossible to identify start Row point\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }\n\n /**\n * Define virtual table position info object.\n *\n * @param {int} rowIndex Index position in line of virtual table.\n * @param {int} cellIndex Index position in column of virtual table.\n * @param {object} baseRow Row affected by this position.\n * @param {object} baseCell Cell affected by this position.\n * @param {bool} isSpan Inform if it is an span cell/row.\n */\n function setVirtualTablePosition(rowIndex, cellIndex, baseRow, baseCell, isRowSpan, isColSpan, isVirtualCell) {\n const objPosition = {\n 'baseRow': baseRow,\n 'baseCell': baseCell,\n 'isRowSpan': isRowSpan,\n 'isColSpan': isColSpan,\n 'isVirtual': isVirtualCell,\n };\n if (!_virtualTable[rowIndex]) {\n _virtualTable[rowIndex] = [];\n }\n _virtualTable[rowIndex][cellIndex] = objPosition;\n }\n\n /**\n * Create action cell object.\n *\n * @param {object} virtualTableCellObj Object of specific position on virtual table.\n * @param {enum} resultAction Action to be applied in that item.\n */\n function getActionCell(virtualTableCellObj, resultAction, virtualRowPosition, virtualColPosition) {\n return {\n 'baseCell': virtualTableCellObj.baseCell,\n 'action': resultAction,\n 'virtualTable': {\n 'rowIndex': virtualRowPosition,\n 'cellIndex': virtualColPosition,\n },\n };\n }\n\n /**\n * Recover free index of row to append Cell.\n *\n * @param {int} rowIndex Index of row to find free space.\n * @param {int} cellIndex Index of cell to find free space in table.\n */\n function recoverCellIndex(rowIndex, cellIndex) {\n if (!_virtualTable[rowIndex]) {\n return cellIndex;\n }\n if (!_virtualTable[rowIndex][cellIndex]) {\n return cellIndex;\n }\n\n let newCellIndex = cellIndex;\n while (_virtualTable[rowIndex][newCellIndex]) {\n newCellIndex++;\n if (!_virtualTable[rowIndex][newCellIndex]) {\n return newCellIndex;\n }\n }\n }\n\n /**\n * Recover info about row and cell and add information to virtual table.\n *\n * @param {object} row Row to recover information.\n * @param {object} cell Cell to recover information.\n */\n function addCellInfoToVirtual(row, cell) {\n const cellIndex = recoverCellIndex(row.rowIndex, cell.cellIndex);\n const cellHasColspan = (cell.colSpan > 1);\n const cellHasRowspan = (cell.rowSpan > 1);\n const isThisSelectedCell = (row.rowIndex === _startPoint.rowPos && cell.cellIndex === _startPoint.colPos);\n setVirtualTablePosition(row.rowIndex, cellIndex, row, cell, cellHasRowspan, cellHasColspan, false);\n\n // Add span rows to virtual Table.\n const rowspanNumber = cell.attributes.rowSpan ? parseInt(cell.attributes.rowSpan.value, 10) : 0;\n if (rowspanNumber > 1) {\n for (let rp = 1; rp < rowspanNumber; rp++) {\n const rowspanIndex = row.rowIndex + rp;\n adjustStartPoint(rowspanIndex, cellIndex, cell, isThisSelectedCell);\n setVirtualTablePosition(rowspanIndex, cellIndex, row, cell, true, cellHasColspan, true);\n }\n }\n\n // Add span cols to virtual table.\n const colspanNumber = cell.attributes.colSpan ? parseInt(cell.attributes.colSpan.value, 10) : 0;\n if (colspanNumber > 1) {\n for (let cp = 1; cp < colspanNumber; cp++) {\n const cellspanIndex = recoverCellIndex(row.rowIndex, (cellIndex + cp));\n adjustStartPoint(row.rowIndex, cellspanIndex, cell, isThisSelectedCell);\n setVirtualTablePosition(row.rowIndex, cellspanIndex, row, cell, cellHasRowspan, true, true);\n }\n }\n }\n\n /**\n * Process validation and adjust of start point if needed\n *\n * @param {int} rowIndex\n * @param {int} cellIndex\n * @param {object} cell\n * @param {bool} isSelectedCell\n */\n function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {\n if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {\n _startPoint.colPos++;\n }\n }\n\n /**\n * Create virtual table of cells with all cells, including span cells.\n */\n function createVirtualTable() {\n const rows = domTable.rows;\n for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n const cells = rows[rowIndex].cells;\n for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }\n\n /**\n * Get action to be applied on the cell.\n *\n * @param {object} cell virtual table cell to apply action\n */\n function getDeleteResultActionToCell(cell) {\n switch (where) {\n case TableResultAction.where.Column:\n if (cell.isColSpan) {\n return TableResultAction.resultAction.SubtractSpanCount;\n }\n break;\n case TableResultAction.where.Row:\n if (!cell.isVirtual && cell.isRowSpan) {\n return TableResultAction.resultAction.AddCell;\n } else if (cell.isRowSpan) {\n return TableResultAction.resultAction.SubtractSpanCount;\n }\n break;\n }\n return TableResultAction.resultAction.RemoveCell;\n }\n\n /**\n * Get action to be applied on the cell.\n *\n * @param {object} cell virtual table cell to apply action\n */\n function getAddResultActionToCell(cell) {\n switch (where) {\n case TableResultAction.where.Column:\n if (cell.isColSpan) {\n return TableResultAction.resultAction.SumSpanCount;\n } else if (cell.isRowSpan && cell.isVirtual) {\n return TableResultAction.resultAction.Ignore;\n }\n break;\n case TableResultAction.where.Row:\n if (cell.isRowSpan) {\n return TableResultAction.resultAction.SumSpanCount;\n } else if (cell.isColSpan && cell.isVirtual) {\n return TableResultAction.resultAction.Ignore;\n }\n break;\n }\n return TableResultAction.resultAction.AddCell;\n }\n\n function init() {\n setStartPoint();\n createVirtualTable();\n }\n\n /// ///////////////////////////////////////////\n // Public functions\n /// ///////////////////////////////////////////\n\n /**\n * Recover array os what to do in table.\n */\n this.getActionList = function() {\n const fixedRow = (where === TableResultAction.where.Row) ? _startPoint.rowPos : -1;\n const fixedCol = (where === TableResultAction.where.Column) ? _startPoint.colPos : -1;\n\n let actualPosition = 0;\n let canContinue = true;\n while (canContinue) {\n const rowPosition = (fixedRow >= 0) ? fixedRow : actualPosition;\n const colPosition = (fixedCol >= 0) ? fixedCol : actualPosition;\n const row = _virtualTable[rowPosition];\n if (!row) {\n canContinue = false;\n return _actionCellList;\n }\n const cell = row[colPosition];\n if (!cell) {\n canContinue = false;\n return _actionCellList;\n }\n\n // Define action to be applied in this cell\n let resultAction = TableResultAction.resultAction.Ignore;\n switch (action) {\n case TableResultAction.requestAction.Add:\n resultAction = getAddResultActionToCell(cell);\n break;\n case TableResultAction.requestAction.Delete:\n resultAction = getDeleteResultActionToCell(cell);\n break;\n }\n _actionCellList.push(getActionCell(cell, resultAction, rowPosition, colPosition));\n actualPosition++;\n }\n\n return _actionCellList;\n };\n\n init();\n};\n/**\n*\n* Where action occours enum.\n*/\nTableResultAction.where = { 'Row': 0, 'Column': 1 };\n/**\n*\n* Requested action to apply enum.\n*/\nTableResultAction.requestAction = { 'Add': 0, 'Delete': 1 };\n/**\n*\n* Result action to be executed enum.\n*/\nTableResultAction.resultAction = { 'Ignore': 0, 'SubtractSpanCount': 1, 'RemoveCell': 2, 'AddCell': 3, 'SumSpanCount': 4 };\n\n/**\n *\n * @class editing.Table\n *\n * Table\n *\n */\nexport default class Table {\n /**\n * handle tab key\n *\n * @param {WrappedRange} rng\n * @param {Boolean} isShift\n */\n tab(rng, isShift) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const table = dom.ancestor(cell, dom.isTable);\n const cells = dom.listDescendant(table, dom.isCell);\n\n const nextCell = lists[isShift ? 'prev' : 'next'](cells, cell);\n if (nextCell) {\n range.create(nextCell, 0).select();\n }\n }\n\n /**\n * Add a new row\n *\n * @param {WrappedRange} rng\n * @param {String} position (top/bottom)\n * @return {Node}\n */\n addRow(rng, position) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n\n const currentTr = $(cell).closest('tr');\n const trAttributes = this.recoverAttributes(currentTr);\n const html = $('<tr' + trAttributes + '></tr>');\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Row,\n TableResultAction.requestAction.Add, $(currentTr).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let idCell = 0; idCell < actions.length; idCell++) {\n const currentCell = actions[idCell];\n const tdAttributes = this.recoverAttributes(currentCell.baseCell);\n switch (currentCell.action) {\n case TableResultAction.resultAction.AddCell:\n html.append('<td' + tdAttributes + '>' + dom.blank + '</td>');\n break;\n case TableResultAction.resultAction.SumSpanCount:\n {\n if (position === 'top') {\n const baseCellTr = currentCell.baseCell.parent;\n const isTopFromRowSpan = (!baseCellTr ? 0 : currentCell.baseCell.closest('tr').rowIndex) <= currentTr[0].rowIndex;\n if (isTopFromRowSpan) {\n const newTd = $('<div></div>').append($('<td' + tdAttributes + '>' + dom.blank + '</td>').removeAttr('rowspan')).html();\n html.append(newTd);\n break;\n }\n }\n let rowspanNumber = parseInt(currentCell.baseCell.rowSpan, 10);\n rowspanNumber++;\n currentCell.baseCell.setAttribute('rowSpan', rowspanNumber);\n }\n break;\n }\n }\n\n if (position === 'top') {\n currentTr.before(html);\n } else {\n const cellHasRowspan = (cell.rowSpan > 1);\n if (cellHasRowspan) {\n const lastTrIndex = currentTr[0].rowIndex + (cell.rowSpan - 2);\n $($(currentTr).parent().find('tr')[lastTrIndex]).after($(html));\n return;\n }\n currentTr.after(html);\n }\n }\n\n /**\n * Add a new col\n *\n * @param {WrappedRange} rng\n * @param {String} position (left/right)\n * @return {Node}\n */\n addCol(rng, position) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const rowsGroup = $(row).siblings();\n rowsGroup.push(row);\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Column,\n TableResultAction.requestAction.Add, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n const currentCell = actions[actionIndex];\n const tdAttributes = this.recoverAttributes(currentCell.baseCell);\n switch (currentCell.action) {\n case TableResultAction.resultAction.AddCell:\n if (position === 'right') {\n $(currentCell.baseCell).after('<td' + tdAttributes + '>' + dom.blank + '</td>');\n } else {\n $(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');\n }\n break;\n case TableResultAction.resultAction.SumSpanCount:\n if (position === 'right') {\n let colspanNumber = parseInt(currentCell.baseCell.colSpan, 10);\n colspanNumber++;\n currentCell.baseCell.setAttribute('colSpan', colspanNumber);\n } else {\n $(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');\n }\n break;\n }\n }\n }\n\n /*\n * Copy attributes from element.\n *\n * @param {object} Element to recover attributes.\n * @return {string} Copied string elements.\n */\n recoverAttributes(el) {\n let resultStr = '';\n\n if (!el) {\n return resultStr;\n }\n\n const attrList = el.attributes || [];\n\n for (let i = 0; i < attrList.length; i++) {\n if (attrList[i].name.toLowerCase() === 'id') {\n continue;\n }\n\n if (attrList[i].specified) {\n resultStr += ' ' + attrList[i].name + '=\\'' + attrList[i].value + '\\'';\n }\n }\n\n return resultStr;\n }\n\n /**\n * Delete current row\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteRow(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const cellPos = row.children('td, th').index($(cell));\n const rowPos = row[0].rowIndex;\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Row,\n TableResultAction.requestAction.Delete, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n if (!actions[actionIndex]) {\n continue;\n }\n\n const baseCell = actions[actionIndex].baseCell;\n const virtualPosition = actions[actionIndex].virtualTable;\n const hasRowspan = (baseCell.rowSpan && baseCell.rowSpan > 1);\n let rowspanNumber = (hasRowspan) ? parseInt(baseCell.rowSpan, 10) : 0;\n switch (actions[actionIndex].action) {\n case TableResultAction.resultAction.Ignore:\n continue;\n case TableResultAction.resultAction.AddCell:\n {\n const nextRow = row.next('tr')[0];\n if (!nextRow) { continue; }\n const cloneRow = row[0].cells[cellPos];\n if (hasRowspan) {\n if (rowspanNumber > 2) {\n rowspanNumber--;\n nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);\n nextRow.cells[cellPos].setAttribute('rowSpan', rowspanNumber);\n nextRow.cells[cellPos].innerHTML = '';\n } else if (rowspanNumber === 2) {\n nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);\n nextRow.cells[cellPos].removeAttribute('rowSpan');\n nextRow.cells[cellPos].innerHTML = '';\n }\n }\n }\n continue;\n case TableResultAction.resultAction.SubtractSpanCount:\n if (hasRowspan) {\n if (rowspanNumber > 2) {\n rowspanNumber--;\n baseCell.setAttribute('rowSpan', rowspanNumber);\n if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n } else if (rowspanNumber === 2) {\n baseCell.removeAttribute('rowSpan');\n if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n }\n }\n continue;\n case TableResultAction.resultAction.RemoveCell:\n // Do not need remove cell because row will be deleted.\n continue;\n }\n }\n row.remove();\n }\n\n /**\n * Delete current col\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteCol(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const cellPos = row.children('td, th').index($(cell));\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Column,\n TableResultAction.requestAction.Delete, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n if (!actions[actionIndex]) {\n continue;\n }\n switch (actions[actionIndex].action) {\n case TableResultAction.resultAction.Ignore:\n continue;\n case TableResultAction.resultAction.SubtractSpanCount:\n {\n const baseCell = actions[actionIndex].baseCell;\n const hasColspan = (baseCell.colSpan && baseCell.colSpan > 1);\n if (hasColspan) {\n let colspanNumber = (baseCell.colSpan) ? parseInt(baseCell.colSpan, 10) : 0;\n if (colspanNumber > 2) {\n colspanNumber--;\n baseCell.setAttribute('colSpan', colspanNumber);\n if (baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n } else if (colspanNumber === 2) {\n baseCell.removeAttribute('colSpan');\n if (baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n }\n }\n }\n continue;\n case TableResultAction.resultAction.RemoveCell:\n dom.remove(actions[actionIndex].baseCell, true);\n continue;\n }\n }\n }\n\n /**\n * create empty table element\n *\n * @param {Number} rowCount\n * @param {Number} colCount\n * @return {Node}\n */\n createTable(colCount, rowCount, options) {\n const tds = [];\n let tdHTML;\n for (let idxCol = 0; idxCol < colCount; idxCol++) {\n tds.push('<td>' + dom.blank + '</td>');\n }\n tdHTML = tds.join('');\n\n const trs = [];\n let trHTML;\n for (let idxRow = 0; idxRow < rowCount; idxRow++) {\n trs.push('<tr>' + tdHTML + '</tr>');\n }\n trHTML = trs.join('');\n const $table = $('<table>' + trHTML + '</table>');\n if (options && options.tableClassName) {\n $table.addClass(options.tableClassName);\n }\n\n return $table[0];\n }\n\n /**\n * Delete current table\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteTable(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n $(cell).closest('table').remove();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport { readFileAsDataURL, createImage } from '../core/async';\nimport History from '../editing/History';\nimport Style from '../editing/Style';\nimport Typing from '../editing/Typing';\nimport Table from '../editing/Table';\nimport Bullet from '../editing/Bullet';\n\nconst KEY_BOGUS = 'bogus';\n\n/**\n * @class Editor\n */\nexport default class Editor {\n constructor(context) {\n this.context = context;\n\n this.$note = context.layoutInfo.note;\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n this.editable = this.$editable[0];\n this.lastRange = null;\n this.snapshot = null;\n\n this.style = new Style();\n this.table = new Table();\n this.typing = new Typing(context);\n this.bullet = new Bullet();\n this.history = new History(context);\n\n this.context.memo('help.undo', this.lang.help.undo);\n this.context.memo('help.redo', this.lang.help.redo);\n this.context.memo('help.tab', this.lang.help.tab);\n this.context.memo('help.untab', this.lang.help.untab);\n this.context.memo('help.insertParagraph', this.lang.help.insertParagraph);\n this.context.memo('help.insertOrderedList', this.lang.help.insertOrderedList);\n this.context.memo('help.insertUnorderedList', this.lang.help.insertUnorderedList);\n this.context.memo('help.indent', this.lang.help.indent);\n this.context.memo('help.outdent', this.lang.help.outdent);\n this.context.memo('help.formatPara', this.lang.help.formatPara);\n this.context.memo('help.insertHorizontalRule', this.lang.help.insertHorizontalRule);\n this.context.memo('help.fontName', this.lang.help.fontName);\n\n // native commands(with execCommand), generate function for execCommand\n const commands = [\n 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',\n 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull',\n 'formatBlock', 'removeFormat', 'backColor',\n ];\n\n for (let idx = 0, len = commands.length; idx < len; idx++) {\n this[commands[idx]] = ((sCmd) => {\n return (value) => {\n this.beforeCommand();\n document.execCommand(sCmd, false, value);\n this.afterCommand(true);\n };\n })(commands[idx]);\n this.context.memo('help.' + commands[idx], this.lang.help[commands[idx]]);\n }\n\n this.fontName = this.wrapCommand((value) => {\n return this.fontStyling('font-family', env.validFontName(value));\n });\n\n this.fontSize = this.wrapCommand((value) => {\n const unit = this.currentStyle()['font-size-unit'];\n return this.fontStyling('font-size', value + unit);\n });\n\n this.fontSizeUnit = this.wrapCommand((value) => {\n const size = this.currentStyle()['font-size'];\n return this.fontStyling('font-size', size + value);\n });\n\n for (let idx = 1; idx <= 6; idx++) {\n this['formatH' + idx] = ((idx) => {\n return () => {\n this.formatBlock('H' + idx);\n };\n })(idx);\n this.context.memo('help.formatH' + idx, this.lang.help['formatH' + idx]);\n }\n\n this.insertParagraph = this.wrapCommand(() => {\n this.typing.insertParagraph(this.editable);\n });\n\n this.insertOrderedList = this.wrapCommand(() => {\n this.bullet.insertOrderedList(this.editable);\n });\n\n this.insertUnorderedList = this.wrapCommand(() => {\n this.bullet.insertUnorderedList(this.editable);\n });\n\n this.indent = this.wrapCommand(() => {\n this.bullet.indent(this.editable);\n });\n\n this.outdent = this.wrapCommand(() => {\n this.bullet.outdent(this.editable);\n });\n\n /**\n * insertNode\n * insert node\n * @param {Node} node\n */\n this.insertNode = this.wrapCommand((node) => {\n if (this.isLimited($(node).text().length)) {\n return;\n }\n const rng = this.getLastRange();\n rng.insertNode(node);\n this.setLastRange(range.createFromNodeAfter(node).select());\n });\n\n /**\n * insert text\n * @param {String} text\n */\n this.insertText = this.wrapCommand((text) => {\n if (this.isLimited(text.length)) {\n return;\n }\n const rng = this.getLastRange();\n const textNode = rng.insertNode(dom.createText(text));\n this.setLastRange(range.create(textNode, dom.nodeLength(textNode)).select());\n });\n\n /**\n * paste HTML\n * @param {String} markup\n */\n this.pasteHTML = this.wrapCommand((markup) => {\n if (this.isLimited(markup.length)) {\n return;\n }\n markup = this.context.invoke('codeview.purify', markup);\n const contents = this.getLastRange().pasteHTML(markup);\n this.setLastRange(range.createFromNodeAfter(lists.last(contents)).select());\n });\n\n /**\n * formatBlock\n *\n * @param {String} tagName\n */\n this.formatBlock = this.wrapCommand((tagName, $target) => {\n const onApplyCustomStyle = this.options.callbacks.onApplyCustomStyle;\n if (onApplyCustomStyle) {\n onApplyCustomStyle.call(this, $target, this.context, this.onFormatBlock);\n } else {\n this.onFormatBlock(tagName, $target);\n }\n });\n\n /**\n * insert horizontal rule\n */\n this.insertHorizontalRule = this.wrapCommand(() => {\n const hrNode = this.getLastRange().insertNode(dom.create('HR'));\n if (hrNode.nextSibling) {\n this.setLastRange(range.create(hrNode.nextSibling, 0).normalize().select());\n }\n });\n\n /**\n * lineHeight\n * @param {String} value\n */\n this.lineHeight = this.wrapCommand((value) => {\n this.style.stylePara(this.getLastRange(), {\n lineHeight: value,\n });\n });\n\n /**\n * create link (command)\n *\n * @param {Object} linkInfo\n */\n this.createLink = this.wrapCommand((linkInfo) => {\n let linkUrl = linkInfo.url;\n const linkText = linkInfo.text;\n const isNewWindow = linkInfo.isNewWindow;\n const checkProtocol = linkInfo.checkProtocol;\n let rng = linkInfo.range || this.getLastRange();\n const additionalTextLength = linkText.length - rng.toString().length;\n if (additionalTextLength > 0 && this.isLimited(additionalTextLength)) {\n return;\n }\n const isTextChanged = rng.toString() !== linkText;\n\n // handle spaced urls from input\n if (typeof linkUrl === 'string') {\n linkUrl = linkUrl.trim();\n }\n\n if (this.options.onCreateLink) {\n linkUrl = this.options.onCreateLink(linkUrl);\n } else if (checkProtocol) {\n // if url doesn't have any protocol and not even a relative or a label, use http:// as default\n linkUrl = /^([A-Za-z][A-Za-z0-9+-.]*\\:|#|\\/)/.test(linkUrl)\n ? linkUrl : this.options.defaultProtocol + linkUrl;\n }\n\n let anchors = [];\n if (isTextChanged) {\n rng = rng.deleteContents();\n const anchor = rng.insertNode($('<A>' + linkText + '</A>')[0]);\n anchors.push(anchor);\n } else {\n anchors = this.style.styleNodes(rng, {\n nodeName: 'A',\n expandClosestSibling: true,\n onlyPartialContains: true,\n });\n }\n\n $.each(anchors, (idx, anchor) => {\n $(anchor).attr('href', linkUrl);\n if (isNewWindow) {\n $(anchor).attr('target', '_blank');\n } else {\n $(anchor).removeAttr('target');\n }\n });\n\n const startRange = range.createFromNodeBefore(lists.head(anchors));\n const startPoint = startRange.getStartPoint();\n const endRange = range.createFromNodeAfter(lists.last(anchors));\n const endPoint = endRange.getEndPoint();\n\n this.setLastRange(\n range.create(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n ).select()\n );\n });\n\n /**\n * setting color\n *\n * @param {Object} sObjColor color code\n * @param {String} sObjColor.foreColor foreground color\n * @param {String} sObjColor.backColor background color\n */\n this.color = this.wrapCommand((colorInfo) => {\n const foreColor = colorInfo.foreColor;\n const backColor = colorInfo.backColor;\n\n if (foreColor) { document.execCommand('foreColor', false, foreColor); }\n if (backColor) { document.execCommand('backColor', false, backColor); }\n });\n\n /**\n * Set foreground color\n *\n * @param {String} colorCode foreground color code\n */\n this.foreColor = this.wrapCommand((colorInfo) => {\n document.execCommand('foreColor', false, colorInfo);\n });\n\n /**\n * insert Table\n *\n * @param {String} dimension of table (ex : \"5x5\")\n */\n this.insertTable = this.wrapCommand((dim) => {\n const dimension = dim.split('x');\n\n const rng = this.getLastRange().deleteContents();\n rng.insertNode(this.table.createTable(dimension[0], dimension[1], this.options));\n });\n\n /**\n * remove media object and Figure Elements if media object is img with Figure.\n */\n this.removeMedia = this.wrapCommand(() => {\n let $target = $(this.restoreTarget()).parent();\n if ($target.closest('figure').length) {\n $target.closest('figure').remove();\n } else {\n $target = $(this.restoreTarget()).detach();\n }\n this.context.triggerEvent('media.delete', $target, this.$editable);\n });\n\n /**\n * float me\n *\n * @param {String} value\n */\n this.floatMe = this.wrapCommand((value) => {\n const $target = $(this.restoreTarget());\n $target.toggleClass('note-float-left', value === 'left');\n $target.toggleClass('note-float-right', value === 'right');\n $target.css('float', (value === 'none' ? '' : value));\n });\n\n /**\n * resize overlay element\n * @param {String} value\n */\n this.resize = this.wrapCommand((value) => {\n const $target = $(this.restoreTarget());\n value = parseFloat(value);\n if (value === 0) {\n $target.css('width', '');\n } else {\n $target.css({\n width: value * 100 + '%',\n height: '',\n });\n }\n });\n }\n\n initialize() {\n // bind custom events\n this.$editable.on('keydown', (event) => {\n if (event.keyCode === key.code.ENTER) {\n this.context.triggerEvent('enter', event);\n }\n this.context.triggerEvent('keydown', event);\n\n // keep a snapshot to limit text on input event\n this.snapshot = this.history.makeSnapshot();\n this.hasKeyShortCut = false;\n if (!event.isDefaultPrevented()) {\n if (this.options.shortcuts) {\n this.hasKeyShortCut = this.handleKeyMap(event);\n } else {\n this.preventDefaultEditableShortCuts(event);\n }\n }\n if (this.isLimited(1, event)) {\n const lastRange = this.getLastRange();\n if (lastRange.eo - lastRange.so === 0) {\n return false;\n }\n }\n this.setLastRange();\n\n // record undo in the key event except keyMap.\n if (this.options.recordEveryKeystroke) {\n if (this.hasKeyShortCut === false) {\n this.history.recordUndo();\n }\n }\n }).on('keyup', (event) => {\n this.setLastRange();\n this.context.triggerEvent('keyup', event);\n }).on('focus', (event) => {\n this.setLastRange();\n this.context.triggerEvent('focus', event);\n }).on('blur', (event) => {\n this.context.triggerEvent('blur', event);\n }).on('mousedown', (event) => {\n this.context.triggerEvent('mousedown', event);\n }).on('mouseup', (event) => {\n this.setLastRange();\n this.history.recordUndo();\n this.context.triggerEvent('mouseup', event);\n }).on('scroll', (event) => {\n this.context.triggerEvent('scroll', event);\n }).on('paste', (event) => {\n this.setLastRange();\n this.context.triggerEvent('paste', event);\n }).on('input', () => {\n // To limit composition characters (e.g. Korean)\n if (this.isLimited(0) && this.snapshot) {\n this.history.applySnapshot(this.snapshot);\n }\n });\n\n this.$editable.attr('spellcheck', this.options.spellCheck);\n\n this.$editable.attr('autocorrect', this.options.spellCheck);\n\n if (this.options.disableGrammar) {\n this.$editable.attr('data-gramm', false);\n }\n\n // init content before set event\n this.$editable.html(dom.html(this.$note) || dom.emptyPara);\n\n this.$editable.on(env.inputEventName, func.debounce(() => {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }, 10));\n\n this.$editable.on('focusin', (event) => {\n this.context.triggerEvent('focusin', event);\n }).on('focusout', (event) => {\n this.context.triggerEvent('focusout', event);\n });\n\n if (this.options.airMode) {\n if (this.options.overrideContextMenu) {\n this.$editor.on('contextmenu', (event) => {\n this.context.triggerEvent('contextmenu', event);\n return false;\n });\n }\n } else {\n if (this.options.width) {\n this.$editor.outerWidth(this.options.width);\n }\n if (this.options.height) {\n this.$editable.outerHeight(this.options.height);\n }\n if (this.options.maxHeight) {\n this.$editable.css('max-height', this.options.maxHeight);\n }\n if (this.options.minHeight) {\n this.$editable.css('min-height', this.options.minHeight);\n }\n }\n\n this.history.recordUndo();\n this.setLastRange();\n }\n\n destroy() {\n this.$editable.off();\n }\n\n handleKeyMap(event) {\n const keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];\n const keys = [];\n\n if (event.metaKey) { keys.push('CMD'); }\n if (event.ctrlKey && !event.altKey) { keys.push('CTRL'); }\n if (event.shiftKey) { keys.push('SHIFT'); }\n\n const keyName = key.nameFromCode[event.keyCode];\n if (keyName) {\n keys.push(keyName);\n }\n\n const eventName = keyMap[keys.join('+')];\n\n if (keyName === 'TAB' && !this.options.tabDisable) {\n this.afterCommand();\n } else if (eventName) {\n if (this.context.invoke(eventName) !== false) {\n event.preventDefault();\n // if keyMap action was invoked\n return true;\n }\n } else if (key.isEdit(event.keyCode)) {\n this.afterCommand();\n }\n return false;\n }\n\n preventDefaultEditableShortCuts(event) {\n // B(Bold, 66) / I(Italic, 73) / U(Underline, 85)\n if ((event.ctrlKey || event.metaKey) &&\n lists.contains([66, 73, 85], event.keyCode)) {\n event.preventDefault();\n }\n }\n\n isLimited(pad, event) {\n pad = pad || 0;\n\n if (typeof event !== 'undefined') {\n if (key.isMove(event.keyCode) ||\n key.isNavigation(event.keyCode) ||\n (event.ctrlKey || event.metaKey) ||\n lists.contains([key.code.BACKSPACE, key.code.DELETE], event.keyCode)) {\n return false;\n }\n }\n\n if (this.options.maxTextLength > 0) {\n if ((this.$editable.text().length + pad) > this.options.maxTextLength) {\n return true;\n }\n }\n return false;\n }\n /**\n * create range\n * @return {WrappedRange}\n */\n createRange() {\n this.focus();\n this.setLastRange();\n return this.getLastRange();\n }\n\n setLastRange(rng) {\n if (rng) {\n this.lastRange = rng;\n } else {\n this.lastRange = range.create(this.editable);\n\n if ($(this.lastRange.sc).closest('.note-editable').length === 0) {\n this.lastRange = range.createFromBodyElement(this.editable);\n }\n }\n }\n\n getLastRange() {\n if (!this.lastRange) {\n this.setLastRange();\n }\n return this.lastRange;\n }\n\n /**\n * saveRange\n *\n * save current range\n *\n * @param {Boolean} [thenCollapse=false]\n */\n saveRange(thenCollapse) {\n if (thenCollapse) {\n this.getLastRange().collapse().select();\n }\n }\n\n /**\n * restoreRange\n *\n * restore lately range\n */\n restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }\n\n saveTarget(node) {\n this.$editable.data('target', node);\n }\n\n clearTarget() {\n this.$editable.removeData('target');\n }\n\n restoreTarget() {\n return this.$editable.data('target');\n }\n\n /**\n * currentStyle\n *\n * current style\n * @return {Object|Boolean} unfocus\n */\n currentStyle() {\n let rng = range.create();\n if (rng) {\n rng = rng.normalize();\n }\n return rng ? this.style.current(rng) : this.style.fromNode(this.$editable);\n }\n\n /**\n * style from node\n *\n * @param {jQuery} $node\n * @return {Object}\n */\n styleFromNode($node) {\n return this.style.fromNode($node);\n }\n\n /**\n * undo\n */\n undo() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.undo();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /*\n * commit\n */\n commit() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.commit();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /**\n * redo\n */\n redo() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.redo();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /**\n * before command\n */\n beforeCommand() {\n this.context.triggerEvent('before.command', this.$editable.html());\n\n // Set styleWithCSS before run a command\n document.execCommand('styleWithCSS', false, this.options.styleWithCSS);\n\n // keep focus on editable before command execution\n this.focus();\n }\n\n /**\n * after command\n * @param {Boolean} isPreventTrigger\n */\n afterCommand(isPreventTrigger) {\n this.normalizeContent();\n this.history.recordUndo();\n if (!isPreventTrigger) {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n }\n\n /**\n * handle tab key\n */\n tab() {\n const rng = this.getLastRange();\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.table.tab(rng);\n } else {\n if (this.options.tabSize === 0) {\n return false;\n }\n\n if (!this.isLimited(this.options.tabSize)) {\n this.beforeCommand();\n this.typing.insertTab(rng, this.options.tabSize);\n this.afterCommand();\n }\n }\n }\n\n /**\n * handle shift+tab key\n */\n untab() {\n const rng = this.getLastRange();\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.table.tab(rng, true);\n } else {\n if (this.options.tabSize === 0) {\n return false;\n }\n }\n }\n\n /**\n * run given function between beforeCommand and afterCommand\n */\n wrapCommand(fn) {\n return function() {\n this.beforeCommand();\n fn.apply(this, arguments);\n this.afterCommand();\n };\n }\n\n /**\n * insert image\n *\n * @param {String} src\n * @param {String|Function} param\n * @return {Promise}\n */\n insertImage(src, param) {\n return createImage(src, param).then(($image) => {\n this.beforeCommand();\n\n if (typeof param === 'function') {\n param($image);\n } else {\n if (typeof param === 'string') {\n $image.attr('data-filename', param);\n }\n $image.css('width', Math.min(this.$editable.width(), $image.width()));\n }\n\n $image.show();\n this.getLastRange().insertNode($image[0]);\n this.setLastRange(range.createFromNodeAfter($image[0]).select());\n this.afterCommand();\n }).fail((e) => {\n this.context.triggerEvent('image.upload.error', e);\n });\n }\n\n /**\n * insertImages\n * @param {File[]} files\n */\n insertImagesAsDataURL(files) {\n $.each(files, (idx, file) => {\n const filename = file.name;\n if (this.options.maximumImageFileSize && this.options.maximumImageFileSize < file.size) {\n this.context.triggerEvent('image.upload.error', this.lang.image.maximumFileSizeError);\n } else {\n readFileAsDataURL(file).then((dataURL) => {\n return this.insertImage(dataURL, filename);\n }).fail(() => {\n this.context.triggerEvent('image.upload.error');\n });\n }\n });\n }\n\n /**\n * insertImagesOrCallback\n * @param {File[]} files\n */\n insertImagesOrCallback(files) {\n const callbacks = this.options.callbacks;\n // If onImageUpload set,\n if (callbacks.onImageUpload) {\n this.context.triggerEvent('image.upload', files);\n // else insert Image as dataURL\n } else {\n this.insertImagesAsDataURL(files);\n }\n }\n\n /**\n * return selected plain text\n * @return {String} text\n */\n getSelectedText() {\n let rng = this.getLastRange();\n\n // if range on anchor, expand range with anchor\n if (rng.isOnAnchor()) {\n rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor));\n }\n\n return rng.toString();\n }\n\n onFormatBlock(tagName, $target) {\n // [workaround] for MSIE, IE need `<`\n document.execCommand('FormatBlock', false, env.isMSIE ? '<' + tagName + '>' : tagName);\n\n // support custom class\n if ($target && $target.length) {\n // find the exact element has given tagName\n if ($target[0].tagName.toUpperCase() !== tagName.toUpperCase()) {\n $target = $target.find(tagName);\n }\n\n if ($target && $target.length) {\n const className = $target[0].className || '';\n if (className) {\n const currentRange = this.createRange();\n\n const $parent = $([currentRange.sc, currentRange.ec]).closest(tagName);\n $parent.addClass(className);\n }\n }\n }\n }\n\n formatPara() {\n this.formatBlock('P');\n }\n\n fontStyling(target, value) {\n const rng = this.getLastRange();\n\n if (rng !== '') {\n const spans = this.style.styleNodes(rng);\n this.$editor.find('.note-status-output').html('');\n $(spans).css(target, value);\n\n // [workaround] added styled bogus span for style\n // - also bogus character needed for cursor position\n if (rng.isCollapsed()) {\n const firstSpan = lists.head(spans);\n if (firstSpan && !dom.nodeLength(firstSpan)) {\n firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR;\n range.createFromNodeAfter(firstSpan.firstChild).select();\n this.setLastRange();\n this.$editable.data(KEY_BOGUS, firstSpan);\n }\n }\n } else {\n const noteStatusOutput = $.now();\n this.$editor.find('.note-status-output').html('<div id=\"note-status-output-' + noteStatusOutput + '\" class=\"alert alert-info\">' + this.lang.output.noSelection + '</div>');\n setTimeout(function() { $('#note-status-output-' + noteStatusOutput).remove(); }, 5000);\n }\n }\n\n /**\n * unlink\n *\n * @type command\n */\n unlink() {\n let rng = this.getLastRange();\n if (rng.isOnAnchor()) {\n const anchor = dom.ancestor(rng.sc, dom.isAnchor);\n rng = range.createFromNode(anchor);\n rng.select();\n this.setLastRange();\n\n this.beforeCommand();\n document.execCommand('unlink');\n this.afterCommand();\n }\n }\n\n /**\n * returns link info\n *\n * @return {Object}\n * @return {WrappedRange} return.range\n * @return {String} return.text\n * @return {Boolean} [return.isNewWindow=true]\n * @return {String} [return.url=\"\"]\n */\n getLinkInfo() {\n const rng = this.getLastRange().expand(dom.isAnchor);\n // Get the first anchor on range(for edit).\n const $anchor = $(lists.head(rng.nodes(dom.isAnchor)));\n const linkInfo = {\n range: rng,\n text: rng.toString(),\n url: $anchor.length ? $anchor.attr('href') : '',\n };\n\n // When anchor exists,\n if ($anchor.length) {\n // Set isNewWindow by checking its target.\n linkInfo.isNewWindow = $anchor.attr('target') === '_blank';\n }\n\n return linkInfo;\n }\n\n addRow(position) {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.addRow(rng, position);\n this.afterCommand();\n }\n }\n\n addCol(position) {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.addCol(rng, position);\n this.afterCommand();\n }\n }\n\n deleteRow() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteRow(rng);\n this.afterCommand();\n }\n }\n\n deleteCol() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteCol(rng);\n this.afterCommand();\n }\n }\n\n deleteTable() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteTable(rng);\n this.afterCommand();\n }\n }\n\n /**\n * @param {Position} pos\n * @param {jQuery} $target - target element\n * @param {Boolean} [bKeepRatio] - keep ratio\n */\n resizeTo(pos, $target, bKeepRatio) {\n let imageSize;\n if (bKeepRatio) {\n const newRatio = pos.y / pos.x;\n const ratio = $target.data('ratio');\n imageSize = {\n width: ratio > newRatio ? pos.x : pos.y / ratio,\n height: ratio > newRatio ? pos.x * ratio : pos.y,\n };\n } else {\n imageSize = {\n width: pos.x,\n height: pos.y,\n };\n }\n\n $target.css(imageSize);\n }\n\n /**\n * returns whether editable area has focus or not.\n */\n hasFocus() {\n return this.$editable.is(':focus');\n }\n\n /**\n * set focus\n */\n focus() {\n // [workaround] Screen will move when page is scolled in IE.\n // - do focus when not focused\n if (!this.hasFocus()) {\n this.$editable.focus();\n }\n }\n\n /**\n * returns whether contents is empty or not.\n * @return {Boolean}\n */\n isEmpty() {\n return dom.isEmpty(this.$editable[0]) || dom.emptyPara === this.$editable.html();\n }\n\n /**\n * Removes all contents and restores the editable instance to an _emptyPara_.\n */\n empty() {\n this.context.invoke('code', dom.emptyPara);\n }\n\n /**\n * normalize content\n */\n normalizeContent() {\n this.$editable[0].normalize();\n }\n}\n","import $ from 'jquery';\n\n/**\n * @method readFileAsDataURL\n *\n * read contents of file as representing URL\n *\n * @param {File} file\n * @return {Promise} - then: dataUrl\n */\nexport function readFileAsDataURL(file) {\n return $.Deferred((deferred) => {\n $.extend(new FileReader(), {\n onload: (e) => {\n const dataURL = e.target.result;\n deferred.resolve(dataURL);\n },\n onerror: (err) => {\n deferred.reject(err);\n },\n }).readAsDataURL(file);\n }).promise();\n}\n\n/**\n * @method createImage\n *\n * create `<image>` from url string\n *\n * @param {String} url\n * @return {Promise} - then: $image\n */\nexport function createImage(url) {\n return $.Deferred((deferred) => {\n const $img = $('<img>');\n\n $img.one('load', () => {\n $img.off('error abort');\n deferred.resolve($img);\n }).one('error abort', () => {\n $img.off('load').detach();\n deferred.reject($img);\n }).css({\n display: 'none',\n }).appendTo(document.body).attr('src', url);\n }).promise();\n}\n","import lists from '../core/lists';\n\nexport default class Clipboard {\n constructor(context) {\n this.context = context;\n this.$editable = context.layoutInfo.editable;\n }\n\n initialize() {\n this.$editable.on('paste', this.pasteByEvent.bind(this));\n }\n\n /**\n * paste by clipboard event\n *\n * @param {Event} event\n */\n pasteByEvent(event) {\n const clipboardData = event.originalEvent.clipboardData;\n\n if (clipboardData && clipboardData.items && clipboardData.items.length) {\n const item = clipboardData.items.length > 1 ? clipboardData.items[1] : lists.head(clipboardData.items);\n if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {\n // paste img file\n this.context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]);\n event.preventDefault();\n } else if (item.kind === 'string') {\n // paste text with maxTextLength check\n if (this.context.invoke('editor.isLimited', clipboardData.getData('Text').length)) {\n event.preventDefault();\n }\n }\n } else if (window.clipboardData) {\n // for IE\n let text = window.clipboardData.getData('text');\n if (this.context.invoke('editor.isLimited', text.length)) {\n event.preventDefault();\n }\n }\n // Call editor.afterCommand after proceeding default event handler\n setTimeout(() => {\n this.context.invoke('editor.afterCommand');\n }, 10);\n }\n}\n","import env from '../core/env';\nimport dom from '../core/dom';\n\nlet CodeMirror;\nif (env.hasCodeMirror) {\n CodeMirror = window.CodeMirror;\n}\n\n/**\n * @class Codeview\n */\nexport default class CodeView {\n constructor(context) {\n this.context = context;\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.$codable = context.layoutInfo.codable;\n this.options = context.options;\n }\n\n sync() {\n const isCodeview = this.isActivated();\n if (isCodeview && env.hasCodeMirror) {\n this.$codable.data('cmEditor').save();\n }\n }\n\n /**\n * @return {Boolean}\n */\n isActivated() {\n return this.$editor.hasClass('codeview');\n }\n\n /**\n * toggle codeview\n */\n toggle() {\n if (this.isActivated()) {\n this.deactivate();\n } else {\n this.activate();\n }\n this.context.triggerEvent('codeview.toggled');\n }\n\n /**\n * purify input value\n * @param value\n * @returns {*}\n */\n purify(value) {\n if (this.options.codeviewFilter) {\n // filter code view regex\n value = value.replace(this.options.codeviewFilterRegex, '');\n // allow specific iframe tag\n if (this.options.codeviewIframeFilter) {\n const whitelist = this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);\n value = value.replace(/(<iframe.*?>.*?(?:<\\/iframe>)?)/gi, function(tag) {\n // remove if src attribute is duplicated\n if (/<.+src(?==?('|\"|\\s)?)[\\s\\S]+src(?=('|\"|\\s)?)[^>]*?>/i.test(tag)) {\n return '';\n }\n for (const src of whitelist) {\n // pass if src is trusted\n if ((new RegExp('src=\"(https?:)?\\/\\/' + src.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') + '\\/(.+)\"')).test(tag)) {\n return tag;\n }\n }\n return '';\n });\n }\n }\n return value;\n }\n\n /**\n * activate code view\n */\n activate() {\n this.$codable.val(dom.html(this.$editable, this.options.prettifyHtml));\n this.$codable.height(this.$editable.height());\n\n this.context.invoke('toolbar.updateCodeview', true);\n this.$editor.addClass('codeview');\n this.$codable.focus();\n\n // activate CodeMirror as codable\n if (env.hasCodeMirror) {\n const cmEditor = CodeMirror.fromTextArea(this.$codable[0], this.options.codemirror);\n\n // CodeMirror TernServer\n if (this.options.codemirror.tern) {\n const server = new CodeMirror.TernServer(this.options.codemirror.tern);\n cmEditor.ternServer = server;\n cmEditor.on('cursorActivity', (cm) => {\n server.updateArgHints(cm);\n });\n }\n\n cmEditor.on('blur', (event) => {\n this.context.triggerEvent('blur.codeview', cmEditor.getValue(), event);\n });\n cmEditor.on('change', () => {\n this.context.triggerEvent('change.codeview', cmEditor.getValue(), cmEditor);\n });\n\n // CodeMirror hasn't Padding.\n cmEditor.setSize(null, this.$editable.outerHeight());\n this.$codable.data('cmEditor', cmEditor);\n } else {\n this.$codable.on('blur', (event) => {\n this.context.triggerEvent('blur.codeview', this.$codable.val(), event);\n });\n this.$codable.on('input', () => {\n this.context.triggerEvent('change.codeview', this.$codable.val(), this.$codable);\n });\n }\n }\n\n /**\n * deactivate code view\n */\n deactivate() {\n // deactivate CodeMirror as codable\n if (env.hasCodeMirror) {\n const cmEditor = this.$codable.data('cmEditor');\n this.$codable.val(cmEditor.getValue());\n cmEditor.toTextArea();\n }\n\n const value = this.purify(dom.value(this.$codable, this.options.prettifyHtml) || dom.emptyPara);\n const isChange = this.$editable.html() !== value;\n\n this.$editable.html(value);\n this.$editable.height(this.options.height ? this.$codable.height() : 'auto');\n this.$editor.removeClass('codeview');\n\n if (isChange) {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n this.$editable.focus();\n\n this.context.invoke('toolbar.updateCodeview', false);\n }\n\n destroy() {\n if (this.isActivated()) {\n this.deactivate();\n }\n }\n}\n","import $ from 'jquery';\n\nexport default class Dropzone {\n constructor(context) {\n this.context = context;\n this.$eventListener = $(document);\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.lang = this.options.langInfo;\n this.documentEventHandlers = {};\n\n this.$dropzone = $([\n '<div class=\"note-dropzone\">',\n '<div class=\"note-dropzone-message\"/>',\n '</div>',\n ].join('')).prependTo(this.$editor);\n }\n\n /**\n * attach Drag and Drop Events\n */\n initialize() {\n if (this.options.disableDragAndDrop) {\n // prevent default drop event\n this.documentEventHandlers.onDrop = (e) => {\n e.preventDefault();\n };\n // do not consider outside of dropzone\n this.$eventListener = this.$dropzone;\n this.$eventListener.on('drop', this.documentEventHandlers.onDrop);\n } else {\n this.attachDragAndDropEvent();\n }\n }\n\n /**\n * attach Drag and Drop Events\n */\n attachDragAndDropEvent() {\n let collection = $();\n const $dropzoneMessage = this.$dropzone.find('.note-dropzone-message');\n\n this.documentEventHandlers.onDragenter = (e) => {\n const isCodeview = this.context.invoke('codeview.isActivated');\n const hasEditorSize = this.$editor.width() > 0 && this.$editor.height() > 0;\n if (!isCodeview && !collection.length && hasEditorSize) {\n this.$editor.addClass('dragover');\n this.$dropzone.width(this.$editor.width());\n this.$dropzone.height(this.$editor.height());\n $dropzoneMessage.text(this.lang.image.dragImageHere);\n }\n collection = collection.add(e.target);\n };\n\n this.documentEventHandlers.onDragleave = (e) => {\n collection = collection.not(e.target);\n\n // If nodeName is BODY, then just make it over (fix for IE)\n if (!collection.length || e.target.nodeName === 'BODY') {\n collection = $();\n this.$editor.removeClass('dragover');\n }\n };\n\n this.documentEventHandlers.onDrop = () => {\n collection = $();\n this.$editor.removeClass('dragover');\n };\n\n // show dropzone on dragenter when dragging a object to document\n // -but only if the editor is visible, i.e. has a positive width and height\n this.$eventListener.on('dragenter', this.documentEventHandlers.onDragenter)\n .on('dragleave', this.documentEventHandlers.onDragleave)\n .on('drop', this.documentEventHandlers.onDrop);\n\n // change dropzone's message on hover.\n this.$dropzone.on('dragenter', () => {\n this.$dropzone.addClass('hover');\n $dropzoneMessage.text(this.lang.image.dropImage);\n }).on('dragleave', () => {\n this.$dropzone.removeClass('hover');\n $dropzoneMessage.text(this.lang.image.dragImageHere);\n });\n\n // attach dropImage\n this.$dropzone.on('drop', (event) => {\n const dataTransfer = event.originalEvent.dataTransfer;\n\n // stop the browser from opening the dropped content\n event.preventDefault();\n\n if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {\n this.$editable.focus();\n this.context.invoke('editor.insertImagesOrCallback', dataTransfer.files);\n } else {\n $.each(dataTransfer.types, (idx, type) => {\n // skip moz-specific types\n if (type.toLowerCase().indexOf('_moz_') > -1) {\n return;\n }\n const content = dataTransfer.getData(type);\n\n if (type.toLowerCase().indexOf('text') > -1) {\n this.context.invoke('editor.pasteHTML', content);\n } else {\n $(content).each((idx, item) => {\n this.context.invoke('editor.insertNode', item);\n });\n }\n });\n }\n }).on('dragover', false); // prevent default dragover event\n }\n\n destroy() {\n Object.keys(this.documentEventHandlers).forEach((key) => {\n this.$eventListener.off(key.substr(2).toLowerCase(), this.documentEventHandlers[key]);\n });\n this.documentEventHandlers = {};\n }\n}\n","import $ from 'jquery';\nconst EDITABLE_PADDING = 24;\n\nexport default class Statusbar {\n constructor(context) {\n this.$document = $(document);\n this.$statusbar = context.layoutInfo.statusbar;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n }\n\n initialize() {\n if (this.options.airMode || this.options.disableResizeEditor) {\n this.destroy();\n return;\n }\n\n this.$statusbar.on('mousedown', (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n const editableTop = this.$editable.offset().top - this.$document.scrollTop();\n const onMouseMove = (event) => {\n let height = event.clientY - (editableTop + EDITABLE_PADDING);\n\n height = (this.options.minheight > 0) ? Math.max(height, this.options.minheight) : height;\n height = (this.options.maxHeight > 0) ? Math.min(height, this.options.maxHeight) : height;\n\n this.$editable.height(height);\n };\n\n this.$document.on('mousemove', onMouseMove).one('mouseup', () => {\n this.$document.off('mousemove', onMouseMove);\n });\n });\n }\n\n destroy() {\n this.$statusbar.off();\n this.$statusbar.addClass('locked');\n }\n}\n","import $ from 'jquery';\n\nexport default class Fullscreen {\n constructor(context) {\n this.context = context;\n\n this.$editor = context.layoutInfo.editor;\n this.$toolbar = context.layoutInfo.toolbar;\n this.$editable = context.layoutInfo.editable;\n this.$codable = context.layoutInfo.codable;\n\n this.$window = $(window);\n this.$scrollbar = $('html, body');\n\n this.onResize = () => {\n this.resizeTo({\n h: this.$window.height() - this.$toolbar.outerHeight(),\n });\n };\n }\n\n resizeTo(size) {\n this.$editable.css('height', size.h);\n this.$codable.css('height', size.h);\n if (this.$codable.data('cmeditor')) {\n this.$codable.data('cmeditor').setsize(null, size.h);\n }\n }\n\n /**\n * toggle fullscreen\n */\n toggle() {\n this.$editor.toggleClass('fullscreen');\n if (this.isFullscreen()) {\n this.$editable.data('orgHeight', this.$editable.css('height'));\n this.$editable.data('orgMaxHeight', this.$editable.css('maxHeight'));\n this.$editable.css('maxHeight', '');\n this.$window.on('resize', this.onResize).trigger('resize');\n this.$scrollbar.css('overflow', 'hidden');\n } else {\n this.$window.off('resize', this.onResize);\n this.resizeTo({ h: this.$editable.data('orgHeight') });\n this.$editable.css('maxHeight', this.$editable.css('orgMaxHeight'));\n this.$scrollbar.css('overflow', 'visible');\n }\n\n this.context.invoke('toolbar.updateFullscreen', this.isFullscreen());\n }\n\n isFullscreen() {\n return this.$editor.hasClass('fullscreen');\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\n\nexport default class Handle {\n constructor(context) {\n this.context = context;\n this.$document = $(document);\n this.$editingArea = context.layoutInfo.editingArea;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n this.events = {\n 'summernote.mousedown': (we, e) => {\n if (this.update(e.target, e)) {\n e.preventDefault();\n }\n },\n 'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown': () => {\n this.update();\n },\n 'summernote.disable summernote.blur': () => {\n this.hide();\n },\n 'summernote.codeview.toggled': () => {\n this.update();\n },\n };\n }\n\n initialize() {\n this.$handle = $([\n '<div class=\"note-handle\">',\n '<div class=\"note-control-selection\">',\n '<div class=\"note-control-selection-bg\"></div>',\n '<div class=\"note-control-holder note-control-nw\"></div>',\n '<div class=\"note-control-holder note-control-ne\"></div>',\n '<div class=\"note-control-holder note-control-sw\"></div>',\n '<div class=\"',\n (this.options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing'),\n ' note-control-se\"></div>',\n (this.options.disableResizeImage ? '' : '<div class=\"note-control-selection-info\"></div>'),\n '</div>',\n '</div>',\n ].join('')).prependTo(this.$editingArea);\n\n this.$handle.on('mousedown', (event) => {\n if (dom.isControlSizing(event.target)) {\n event.preventDefault();\n event.stopPropagation();\n\n const $target = this.$handle.find('.note-control-selection').data('target');\n const posStart = $target.offset();\n const scrollTop = this.$document.scrollTop();\n\n const onMouseMove = (event) => {\n this.context.invoke('editor.resizeTo', {\n x: event.clientX - posStart.left,\n y: event.clientY - (posStart.top - scrollTop),\n }, $target, !event.shiftKey);\n\n this.update($target[0], event);\n };\n\n this.$document\n .on('mousemove', onMouseMove)\n .one('mouseup', (e) => {\n e.preventDefault();\n this.$document.off('mousemove', onMouseMove);\n this.context.invoke('editor.afterCommand');\n });\n\n if (!$target.data('ratio')) { // original ratio.\n $target.data('ratio', $target.height() / $target.width());\n }\n }\n });\n\n // Listen for scrolling on the handle overlay.\n this.$handle.on('wheel', (e) => {\n e.preventDefault();\n this.update();\n });\n }\n\n destroy() {\n this.$handle.remove();\n }\n\n update(target, event) {\n if (this.context.isDisabled()) {\n return false;\n }\n\n const isImage = dom.isImg(target);\n const $selection = this.$handle.find('.note-control-selection');\n\n this.context.invoke('imagePopover.update', target, event);\n\n if (isImage) {\n const $image = $(target);\n const position = $image.position();\n const pos = {\n left: position.left + parseInt($image.css('marginLeft'), 10),\n top: position.top + parseInt($image.css('marginTop'), 10),\n };\n\n // exclude margin\n const imageSize = {\n w: $image.outerWidth(false),\n h: $image.outerHeight(false),\n };\n\n $selection.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n width: imageSize.w,\n height: imageSize.h,\n }).data('target', $image); // save current image element.\n\n const origImageObj = new Image();\n origImageObj.src = $image.attr('src');\n\n const sizingText = imageSize.w + 'x' + imageSize.h + ' (' + this.lang.image.original + ': ' + origImageObj.width + 'x' + origImageObj.height + ')';\n $selection.find('.note-control-selection-info').text(sizingText);\n this.context.invoke('editor.saveTarget', target);\n } else {\n this.hide();\n }\n\n return isImage;\n }\n\n /**\n * hide\n *\n * @param {jQuery} $handle\n */\n hide() {\n this.context.invoke('editor.clearTarget');\n this.$handle.children().hide();\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport key from '../core/key';\n\nconst defaultScheme = 'http://';\nconst linkPattern = /^([A-Za-z][A-Za-z0-9+-.]*\\:[\\/]{2}|tel:|mailto:[A-Z0-9._%+-]+@)?(www\\.)?(.+)$/i;\n\nexport default class AutoLink {\n constructor(context) {\n this.context = context;\n this.events = {\n 'summernote.keyup': (we, e) => {\n if (!e.isDefaultPrevented()) {\n this.handleKeyup(e);\n }\n },\n 'summernote.keydown': (we, e) => {\n this.handleKeydown(e);\n },\n };\n }\n\n initialize() {\n this.lastWordRange = null;\n }\n\n destroy() {\n this.lastWordRange = null;\n }\n\n replace() {\n if (!this.lastWordRange) {\n return;\n }\n\n const keyword = this.lastWordRange.toString();\n const match = keyword.match(linkPattern);\n\n if (match && (match[1] || match[2])) {\n const link = match[1] ? keyword : defaultScheme + keyword;\n const urlText = keyword.replace(/^(?:https?:\\/\\/)?(?:tel?:?)?(?:mailto?:?)?(?:www\\.)?/i, '').split('/')[0];\n const node = $('<a />').html(urlText).attr('href', link)[0];\n if (this.context.options.linkTargetBlank) {\n $(node).attr('target', '_blank');\n }\n\n this.lastWordRange.insertNode(node);\n this.lastWordRange = null;\n this.context.invoke('editor.focus');\n }\n }\n\n handleKeydown(e) {\n if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {\n const wordRange = this.context.invoke('editor.createRange').getWordRange();\n this.lastWordRange = wordRange;\n }\n }\n\n handleKeyup(e) {\n if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {\n this.replace();\n }\n }\n}\n","import dom from '../core/dom';\n\n/**\n * textarea auto sync.\n */\nexport default class AutoSync {\n constructor(context) {\n this.$note = context.layoutInfo.note;\n this.events = {\n 'summernote.change': () => {\n this.$note.val(context.invoke('code'));\n },\n };\n }\n\n shouldInitialize() {\n return dom.isTextarea(this.$note[0]);\n }\n}\n","import lists from '../core/lists';\nimport dom from '../core/dom';\nimport key from '../core/key';\n\nexport default class AutoReplace {\n constructor(context) {\n this.context = context;\n this.options = context.options.replace || {};\n\n this.keys = [key.code.ENTER, key.code.SPACE, key.code.PERIOD, key.code.COMMA, key.code.SEMICOLON, key.code.SLASH];\n this.previousKeydownCode = null;\n\n this.events = {\n 'summernote.keyup': (we, e) => {\n if (!e.isDefaultPrevented()) {\n this.handleKeyup(e);\n }\n },\n 'summernote.keydown': (we, e) => {\n this.handleKeydown(e);\n },\n };\n }\n\n shouldInitialize() {\n return !!this.options.match;\n }\n\n initialize() {\n this.lastWord = null;\n }\n\n destroy() {\n this.lastWord = null;\n }\n\n replace() {\n if (!this.lastWord) {\n return;\n }\n\n const self = this;\n const keyword = this.lastWord.toString();\n this.options.match(keyword, function(match) {\n if (match) {\n let node = '';\n\n if (typeof match === 'string') {\n node = dom.createText(match);\n } else if (match instanceof jQuery) {\n node = match[0];\n } else if (match instanceof Node) {\n node = match;\n }\n\n if (!node) return;\n self.lastWord.insertNode(node);\n self.lastWord = null;\n self.context.invoke('editor.focus');\n }\n });\n }\n\n handleKeydown(e) {\n // this forces it to remember the last whole word, even if multiple termination keys are pressed\n // before the previous key is let go.\n if (this.previousKeydownCode && lists.contains(this.keys, this.previousKeydownCode)) {\n this.previousKeydownCode = e.keyCode;\n return;\n }\n\n if (lists.contains(this.keys, e.keyCode)) {\n const wordRange = this.context.invoke('editor.createRange').getWordRange();\n this.lastWord = wordRange;\n }\n this.previousKeydownCode = e.keyCode;\n }\n\n handleKeyup(e) {\n if (lists.contains(this.keys, e.keyCode)) {\n this.replace();\n }\n }\n}\n","import $ from 'jquery';\nexport default class Placeholder {\n constructor(context) {\n this.context = context;\n\n this.$editingArea = context.layoutInfo.editingArea;\n this.options = context.options;\n\n if (this.options.inheritPlaceholder === true) {\n // get placeholder value from the original element\n this.options.placeholder = this.context.$note.attr('placeholder') || this.options.placeholder;\n }\n\n this.events = {\n 'summernote.init summernote.change': () => {\n this.update();\n },\n 'summernote.codeview.toggled': () => {\n this.update();\n },\n };\n }\n\n shouldInitialize() {\n return !!this.options.placeholder;\n }\n\n initialize() {\n this.$placeholder = $('<div class=\"note-placeholder\">');\n this.$placeholder.on('click', () => {\n this.context.invoke('focus');\n }).html(this.options.placeholder).prependTo(this.$editingArea);\n\n this.update();\n }\n\n destroy() {\n this.$placeholder.remove();\n }\n\n update() {\n const isShow = !this.context.invoke('codeview.isActivated') && this.context.invoke('editor.isEmpty');\n this.$placeholder.toggle(isShow);\n }\n}\n","import $ from 'jquery';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport env from '../core/env';\n\nexport default class Buttons {\n constructor(context) {\n this.ui = $.summernote.ui;\n this.context = context;\n this.$toolbar = context.layoutInfo.toolbar;\n this.options = context.options;\n this.lang = this.options.langInfo;\n this.invertedKeyMap = func.invertObject(\n this.options.keyMap[env.isMac ? 'mac' : 'pc']\n );\n }\n\n representShortcut(editorMethod) {\n let shortcut = this.invertedKeyMap[editorMethod];\n if (!this.options.shortcuts || !shortcut) {\n return '';\n }\n\n if (env.isMac) {\n shortcut = shortcut.replace('CMD', '?').replace('SHIFT', '?');\n }\n\n shortcut = shortcut.replace('BACKSLASH', '\\\\')\n .replace('SLASH', '/')\n .replace('LEFTBRACKET', '[')\n .replace('RIGHTBRACKET', ']');\n\n return ' (' + shortcut + ')';\n }\n\n button(o) {\n if (!this.options.tooltip && o.tooltip) {\n delete o.tooltip;\n }\n o.container = this.options.container;\n return this.ui.button(o);\n }\n\n initialize() {\n this.addToolbarButtons();\n this.addImagePopoverButtons();\n this.addLinkPopoverButtons();\n this.addTablePopoverButtons();\n this.fontInstalledMap = {};\n }\n\n destroy() {\n delete this.fontInstalledMap;\n }\n\n isFontInstalled(name) {\n if (!Object.prototype.hasOwnProperty.call(this.fontInstalledMap, name)) {\n this.fontInstalledMap[name] = env.isFontInstalled(name) ||\n lists.contains(this.options.fontNamesIgnoreCheck, name);\n }\n return this.fontInstalledMap[name];\n }\n\n isFontDeservedToAdd(name) {\n name = name.toLowerCase();\n return (name !== '' && this.isFontInstalled(name) && env.genericFontFamilies.indexOf(name) === -1);\n }\n\n colorPalette(className, tooltip, backColor, foreColor) {\n return this.ui.buttonGroup({\n className: 'note-color ' + className,\n children: [\n this.button({\n className: 'note-current-color-button',\n contents: this.ui.icon(this.options.icons.font + ' note-recent-color'),\n tooltip: tooltip,\n click: (e) => {\n const $button = $(e.currentTarget);\n if (backColor && foreColor) {\n this.context.invoke('editor.color', {\n backColor: $button.attr('data-backColor'),\n foreColor: $button.attr('data-foreColor'),\n });\n } else if (backColor) {\n this.context.invoke('editor.color', {\n backColor: $button.attr('data-backColor'),\n });\n } else if (foreColor) {\n this.context.invoke('editor.color', {\n foreColor: $button.attr('data-foreColor'),\n });\n }\n },\n callback: ($button) => {\n const $recentColor = $button.find('.note-recent-color');\n if (backColor) {\n $recentColor.css('background-color', this.options.colorButton.backColor);\n $button.attr('data-backColor', this.options.colorButton.backColor);\n }\n if (foreColor) {\n $recentColor.css('color', this.options.colorButton.foreColor);\n $button.attr('data-foreColor', this.options.colorButton.foreColor);\n } else {\n $recentColor.css('color', 'transparent');\n }\n },\n }),\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('', this.options),\n tooltip: this.lang.color.more,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n items: (backColor ? [\n '<div class=\"note-palette\">',\n '<div class=\"note-palette-title\">' + this.lang.color.background + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset btn btn-light\" data-event=\"backColor\" data-value=\"inherit\">',\n this.lang.color.transparent,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"backColor\"/>',\n '<div>',\n '<button type=\"button\" class=\"note-color-select btn btn-light\" data-event=\"openPalette\" data-value=\"backColorPicker\">',\n this.lang.color.cpSelect,\n '</button>',\n '<input type=\"color\" id=\"backColorPicker\" class=\"note-btn note-color-select-btn\" value=\"' + this.options.colorButton.backColor + '\" data-event=\"backColorPalette\">',\n '</div>',\n '<div class=\"note-holder-custom\" id=\"backColorPalette\" data-event=\"backColor\"/>',\n '</div>',\n ].join('') : '') +\n (foreColor ? [\n '<div class=\"note-palette\">',\n '<div class=\"note-palette-title\">' + this.lang.color.foreground + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset btn btn-light\" data-event=\"removeFormat\" data-value=\"foreColor\">',\n this.lang.color.resetToDefault,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"foreColor\"/>',\n '<div>',\n '<button type=\"button\" class=\"note-color-select btn btn-light\" data-event=\"openPalette\" data-value=\"foreColorPicker\">',\n this.lang.color.cpSelect,\n '</button>',\n '<input type=\"color\" id=\"foreColorPicker\" class=\"note-btn note-color-select-btn\" value=\"' + this.options.colorButton.foreColor + '\" data-event=\"foreColorPalette\">',\n '</div>', // Fix missing Div, Commented to find easily if it's wrong\n '<div class=\"note-holder-custom\" id=\"foreColorPalette\" data-event=\"foreColor\"/>',\n '</div>',\n ].join('') : ''),\n callback: ($dropdown) => {\n $dropdown.find('.note-holder').each((idx, item) => {\n const $holder = $(item);\n $holder.append(this.ui.palette({\n colors: this.options.colors,\n colorsName: this.options.colorsName,\n eventName: $holder.data('event'),\n container: this.options.container,\n tooltip: this.options.tooltip,\n }).render());\n });\n /* TODO: do we have to record recent custom colors within cookies? */\n var customColors = [\n ['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF'],\n ];\n $dropdown.find('.note-holder-custom').each((idx, item) => {\n const $holder = $(item);\n $holder.append(this.ui.palette({\n colors: customColors,\n colorsName: customColors,\n eventName: $holder.data('event'),\n container: this.options.container,\n tooltip: this.options.tooltip,\n }).render());\n });\n $dropdown.find('input[type=color]').each((idx, item) => {\n $(item).change(function() {\n const $chip = $dropdown.find('#' + $(this).data('event')).find('.note-color-btn').first();\n const color = this.value.toUpperCase();\n $chip.css('background-color', color)\n .attr('aria-label', color)\n .attr('data-value', color)\n .attr('data-original-title', color);\n $chip.click();\n });\n });\n },\n click: (event) => {\n event.stopPropagation();\n\n const $parent = $('.' + className).find('.note-dropdown-menu');\n const $button = $(event.target);\n const eventName = $button.data('event');\n const value = $button.attr('data-value');\n\n if (eventName === 'openPalette') {\n const $picker = $parent.find('#' + value);\n const $palette = $($parent.find('#' + $picker.data('event')).find('.note-color-row')[0]);\n\n // Shift palette chips\n const $chip = $palette.find('.note-color-btn').last().detach();\n\n // Set chip attributes\n const color = $picker.val();\n $chip.css('background-color', color)\n .attr('aria-label', color)\n .attr('data-value', color)\n .attr('data-original-title', color);\n $palette.prepend($chip);\n $picker.click();\n } else {\n if (lists.contains(['backColor', 'foreColor'], eventName)) {\n const key = eventName === 'backColor' ? 'background-color' : 'color';\n const $color = $button.closest('.note-color').find('.note-recent-color');\n const $currentButton = $button.closest('.note-color').find('.note-current-color-button');\n\n $color.css(key, value);\n $currentButton.attr('data-' + eventName, value);\n }\n this.context.invoke('editor.' + eventName, value);\n }\n },\n }),\n ],\n }).render();\n }\n\n addToolbarButtons() {\n this.context.memo('button.style', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(\n this.ui.icon(this.options.icons.magic), this.options\n ),\n tooltip: this.lang.style.style,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n className: 'dropdown-style',\n items: this.options.styleTags,\n title: this.lang.style.style,\n template: (item) => {\n // TBD: need to be simplified\n if (typeof item === 'string') {\n item = {\n tag: item,\n title: (Object.prototype.hasOwnProperty.call(this.lang.style, item) ? this.lang.style[item] : item),\n };\n }\n\n const tag = item.tag;\n const title = item.title;\n const style = item.style ? ' style=\"' + item.style + '\" ' : '';\n const className = item.className ? ' class=\"' + item.className + '\"' : '';\n\n return '<' + tag + style + className + '>' + title + '</' + tag + '>';\n },\n click: this.context.createInvokeHandler('editor.formatBlock'),\n }),\n ]).render();\n });\n\n for (let styleIdx = 0, styleLen = this.options.styleTags.length; styleIdx < styleLen; styleIdx++) {\n const item = this.options.styleTags[styleIdx];\n\n this.context.memo('button.style.' + item, () => {\n return this.button({\n className: 'note-btn-style-' + item,\n contents: '<div data-value=\"' + item + '\">' + item.toUpperCase() + '</div>',\n tooltip: this.lang.style[item],\n click: this.context.createInvokeHandler('editor.formatBlock'),\n }).render();\n });\n }\n\n this.context.memo('button.bold', () => {\n return this.button({\n className: 'note-btn-bold',\n contents: this.ui.icon(this.options.icons.bold),\n tooltip: this.lang.font.bold + this.representShortcut('bold'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.bold'),\n }).render();\n });\n\n this.context.memo('button.italic', () => {\n return this.button({\n className: 'note-btn-italic',\n contents: this.ui.icon(this.options.icons.italic),\n tooltip: this.lang.font.italic + this.representShortcut('italic'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.italic'),\n }).render();\n });\n\n this.context.memo('button.underline', () => {\n return this.button({\n className: 'note-btn-underline',\n contents: this.ui.icon(this.options.icons.underline),\n tooltip: this.lang.font.underline + this.representShortcut('underline'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.underline'),\n }).render();\n });\n\n this.context.memo('button.clear', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.eraser),\n tooltip: this.lang.font.clear + this.representShortcut('removeFormat'),\n click: this.context.createInvokeHandler('editor.removeFormat'),\n }).render();\n });\n\n this.context.memo('button.strikethrough', () => {\n return this.button({\n className: 'note-btn-strikethrough',\n contents: this.ui.icon(this.options.icons.strikethrough),\n tooltip: this.lang.font.strikethrough + this.representShortcut('strikethrough'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.strikethrough'),\n }).render();\n });\n\n this.context.memo('button.superscript', () => {\n return this.button({\n className: 'note-btn-superscript',\n contents: this.ui.icon(this.options.icons.superscript),\n tooltip: this.lang.font.superscript,\n click: this.context.createInvokeHandlerAndUpdateState('editor.superscript'),\n }).render();\n });\n\n this.context.memo('button.subscript', () => {\n return this.button({\n className: 'note-btn-subscript',\n contents: this.ui.icon(this.options.icons.subscript),\n tooltip: this.lang.font.subscript,\n click: this.context.createInvokeHandlerAndUpdateState('editor.subscript'),\n }).render();\n });\n\n this.context.memo('button.fontname', () => {\n const styleInfo = this.context.invoke('editor.currentStyle');\n\n if (this.options.addDefaultFonts) {\n // Add 'default' fonts into the fontnames array if not exist\n $.each(styleInfo['font-family'].split(','), (idx, fontname) => {\n fontname = fontname.trim().replace(/['\"]+/g, '');\n if (this.isFontDeservedToAdd(fontname)) {\n if (this.options.fontNames.indexOf(fontname) === -1) {\n this.options.fontNames.push(fontname);\n }\n }\n });\n }\n\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(\n '<span class=\"note-current-fontname\"/>', this.options\n ),\n tooltip: this.lang.font.name,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontname',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontNames.filter(this.isFontInstalled.bind(this)),\n title: this.lang.font.name,\n template: (item) => {\n return '<span style=\"font-family: ' + env.validFontName(item) + '\">' + item + '</span>';\n },\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontName'),\n }),\n ]).render();\n });\n\n this.context.memo('button.fontsize', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('<span class=\"note-current-fontsize\"/>', this.options),\n tooltip: this.lang.font.size,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontsize',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontSizes,\n title: this.lang.font.size,\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontSize'),\n }),\n ]).render();\n });\n\n this.context.memo('button.fontsizeunit', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('<span class=\"note-current-fontsizeunit\"/>', this.options),\n tooltip: this.lang.font.sizeunit,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontsizeunit',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontSizeUnits,\n title: this.lang.font.sizeunit,\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontSizeUnit'),\n }),\n ]).render();\n });\n\n this.context.memo('button.color', () => {\n return this.colorPalette('note-color-all', this.lang.color.recent, true, true);\n });\n\n this.context.memo('button.forecolor', () => {\n return this.colorPalette('note-color-fore', this.lang.color.foreground, false, true);\n });\n\n this.context.memo('button.backcolor', () => {\n return this.colorPalette('note-color-back', this.lang.color.background, true, false);\n });\n\n this.context.memo('button.ul', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.unorderedlist),\n tooltip: this.lang.lists.unordered + this.representShortcut('insertUnorderedList'),\n click: this.context.createInvokeHandler('editor.insertUnorderedList'),\n }).render();\n });\n\n this.context.memo('button.ol', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.orderedlist),\n tooltip: this.lang.lists.ordered + this.representShortcut('insertOrderedList'),\n click: this.context.createInvokeHandler('editor.insertOrderedList'),\n }).render();\n });\n\n const justifyLeft = this.button({\n contents: this.ui.icon(this.options.icons.alignLeft),\n tooltip: this.lang.paragraph.left + this.representShortcut('justifyLeft'),\n click: this.context.createInvokeHandler('editor.justifyLeft'),\n });\n\n const justifyCenter = this.button({\n contents: this.ui.icon(this.options.icons.alignCenter),\n tooltip: this.lang.paragraph.center + this.representShortcut('justifyCenter'),\n click: this.context.createInvokeHandler('editor.justifyCenter'),\n });\n\n const justifyRight = this.button({\n contents: this.ui.icon(this.options.icons.alignRight),\n tooltip: this.lang.paragraph.right + this.representShortcut('justifyRight'),\n click: this.context.createInvokeHandler('editor.justifyRight'),\n });\n\n const justifyFull = this.button({\n contents: this.ui.icon(this.options.icons.alignJustify),\n tooltip: this.lang.paragraph.justify + this.representShortcut('justifyFull'),\n click: this.context.createInvokeHandler('editor.justifyFull'),\n });\n\n const outdent = this.button({\n contents: this.ui.icon(this.options.icons.outdent),\n tooltip: this.lang.paragraph.outdent + this.representShortcut('outdent'),\n click: this.context.createInvokeHandler('editor.outdent'),\n });\n\n const indent = this.button({\n contents: this.ui.icon(this.options.icons.indent),\n tooltip: this.lang.paragraph.indent + this.representShortcut('indent'),\n click: this.context.createInvokeHandler('editor.indent'),\n });\n\n this.context.memo('button.justifyLeft', func.invoke(justifyLeft, 'render'));\n this.context.memo('button.justifyCenter', func.invoke(justifyCenter, 'render'));\n this.context.memo('button.justifyRight', func.invoke(justifyRight, 'render'));\n this.context.memo('button.justifyFull', func.invoke(justifyFull, 'render'));\n this.context.memo('button.outdent', func.invoke(outdent, 'render'));\n this.context.memo('button.indent', func.invoke(indent, 'render'));\n\n this.context.memo('button.paragraph', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.alignLeft), this.options),\n tooltip: this.lang.paragraph.paragraph,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown([\n this.ui.buttonGroup({\n className: 'note-align',\n children: [justifyLeft, justifyCenter, justifyRight, justifyFull],\n }),\n this.ui.buttonGroup({\n className: 'note-list',\n children: [outdent, indent],\n }),\n ]),\n ]).render();\n });\n\n this.context.memo('button.height', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.textHeight), this.options),\n tooltip: this.lang.font.height,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n items: this.options.lineHeights,\n checkClassName: this.options.icons.menuCheck,\n className: 'dropdown-line-height',\n title: this.lang.font.height,\n click: this.context.createInvokeHandler('editor.lineHeight'),\n }),\n ]).render();\n });\n\n this.context.memo('button.table', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.table), this.options),\n tooltip: this.lang.table.table,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n title: this.lang.table.table,\n className: 'note-table',\n items: [\n '<div class=\"note-dimension-picker\">',\n '<div class=\"note-dimension-picker-mousecatcher\" data-event=\"insertTable\" data-value=\"1x1\"/>',\n '<div class=\"note-dimension-picker-highlighted\"/>',\n '<div class=\"note-dimension-picker-unhighlighted\"/>',\n '</div>',\n '<div class=\"note-dimension-display\">1 x 1</div>',\n ].join(''),\n }),\n ], {\n callback: ($node) => {\n const $catcher = $node.find('.note-dimension-picker-mousecatcher');\n $catcher.css({\n width: this.options.insertTableMaxSize.col + 'em',\n height: this.options.insertTableMaxSize.row + 'em',\n }).mousedown(this.context.createInvokeHandler('editor.insertTable'))\n .on('mousemove', this.tableMoveHandler.bind(this));\n },\n }).render();\n });\n\n this.context.memo('button.link', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.link),\n tooltip: this.lang.link.link + this.representShortcut('linkDialog.show'),\n click: this.context.createInvokeHandler('linkDialog.show'),\n }).render();\n });\n\n this.context.memo('button.picture', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.picture),\n tooltip: this.lang.image.image,\n click: this.context.createInvokeHandler('imageDialog.show'),\n }).render();\n });\n\n this.context.memo('button.video', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.video),\n tooltip: this.lang.video.video,\n click: this.context.createInvokeHandler('videoDialog.show'),\n }).render();\n });\n\n this.context.memo('button.hr', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.minus),\n tooltip: this.lang.hr.insert + this.representShortcut('insertHorizontalRule'),\n click: this.context.createInvokeHandler('editor.insertHorizontalRule'),\n }).render();\n });\n\n this.context.memo('button.fullscreen', () => {\n return this.button({\n className: 'btn-fullscreen',\n contents: this.ui.icon(this.options.icons.arrowsAlt),\n tooltip: this.lang.options.fullscreen,\n click: this.context.createInvokeHandler('fullscreen.toggle'),\n }).render();\n });\n\n this.context.memo('button.codeview', () => {\n return this.button({\n className: 'btn-codeview',\n contents: this.ui.icon(this.options.icons.code),\n tooltip: this.lang.options.codeview,\n click: this.context.createInvokeHandler('codeview.toggle'),\n }).render();\n });\n\n this.context.memo('button.redo', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.redo),\n tooltip: this.lang.history.redo + this.representShortcut('redo'),\n click: this.context.createInvokeHandler('editor.redo'),\n }).render();\n });\n\n this.context.memo('button.undo', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.undo),\n tooltip: this.lang.history.undo + this.representShortcut('undo'),\n click: this.context.createInvokeHandler('editor.undo'),\n }).render();\n });\n\n this.context.memo('button.help', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.question),\n tooltip: this.lang.options.help,\n click: this.context.createInvokeHandler('helpDialog.show'),\n }).render();\n });\n }\n\n /**\n * image: [\n * ['imageResize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],\n * ['float', ['floatLeft', 'floatRight', 'floatNone']],\n * ['remove', ['removeMedia']],\n * ],\n */\n addImagePopoverButtons() {\n // Image Size Buttons\n this.context.memo('button.resizeFull', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">100%</span>',\n tooltip: this.lang.image.resizeFull,\n click: this.context.createInvokeHandler('editor.resize', '1'),\n }).render();\n });\n this.context.memo('button.resizeHalf', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">50%</span>',\n tooltip: this.lang.image.resizeHalf,\n click: this.context.createInvokeHandler('editor.resize', '0.5'),\n }).render();\n });\n this.context.memo('button.resizeQuarter', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">25%</span>',\n tooltip: this.lang.image.resizeQuarter,\n click: this.context.createInvokeHandler('editor.resize', '0.25'),\n }).render();\n });\n this.context.memo('button.resizeNone', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.rollback),\n tooltip: this.lang.image.resizeNone,\n click: this.context.createInvokeHandler('editor.resize', '0'),\n }).render();\n });\n\n // Float Buttons\n this.context.memo('button.floatLeft', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.floatLeft),\n tooltip: this.lang.image.floatLeft,\n click: this.context.createInvokeHandler('editor.floatMe', 'left'),\n }).render();\n });\n\n this.context.memo('button.floatRight', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.floatRight),\n tooltip: this.lang.image.floatRight,\n click: this.context.createInvokeHandler('editor.floatMe', 'right'),\n }).render();\n });\n\n this.context.memo('button.floatNone', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.rollback),\n tooltip: this.lang.image.floatNone,\n click: this.context.createInvokeHandler('editor.floatMe', 'none'),\n }).render();\n });\n\n // Remove Buttons\n this.context.memo('button.removeMedia', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.trash),\n tooltip: this.lang.image.remove,\n click: this.context.createInvokeHandler('editor.removeMedia'),\n }).render();\n });\n }\n\n addLinkPopoverButtons() {\n this.context.memo('button.linkDialogShow', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.link),\n tooltip: this.lang.link.edit,\n click: this.context.createInvokeHandler('linkDialog.show'),\n }).render();\n });\n\n this.context.memo('button.unlink', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.unlink),\n tooltip: this.lang.link.unlink,\n click: this.context.createInvokeHandler('editor.unlink'),\n }).render();\n });\n }\n\n /**\n * table : [\n * ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],\n * ['delete', ['deleteRow', 'deleteCol', 'deleteTable']]\n * ],\n */\n addTablePopoverButtons() {\n this.context.memo('button.addRowUp', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowAbove),\n tooltip: this.lang.table.addRowAbove,\n click: this.context.createInvokeHandler('editor.addRow', 'top'),\n }).render();\n });\n this.context.memo('button.addRowDown', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowBelow),\n tooltip: this.lang.table.addRowBelow,\n click: this.context.createInvokeHandler('editor.addRow', 'bottom'),\n }).render();\n });\n this.context.memo('button.addColLeft', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colBefore),\n tooltip: this.lang.table.addColLeft,\n click: this.context.createInvokeHandler('editor.addCol', 'left'),\n }).render();\n });\n this.context.memo('button.addColRight', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colAfter),\n tooltip: this.lang.table.addColRight,\n click: this.context.createInvokeHandler('editor.addCol', 'right'),\n }).render();\n });\n this.context.memo('button.deleteRow', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowRemove),\n tooltip: this.lang.table.delRow,\n click: this.context.createInvokeHandler('editor.deleteRow'),\n }).render();\n });\n this.context.memo('button.deleteCol', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colRemove),\n tooltip: this.lang.table.delCol,\n click: this.context.createInvokeHandler('editor.deleteCol'),\n }).render();\n });\n this.context.memo('button.deleteTable', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.trash),\n tooltip: this.lang.table.delTable,\n click: this.context.createInvokeHandler('editor.deleteTable'),\n }).render();\n });\n }\n\n build($container, groups) {\n for (let groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) {\n const group = groups[groupIdx];\n const groupName = Array.isArray(group) ? group[0] : group;\n const buttons = Array.isArray(group) ? ((group.length === 1) ? [group[0]] : group[1]) : [group];\n\n const $group = this.ui.buttonGroup({\n className: 'note-' + groupName,\n }).render();\n\n for (let idx = 0, len = buttons.length; idx < len; idx++) {\n const btn = this.context.memo('button.' + buttons[idx]);\n if (btn) {\n $group.append(typeof btn === 'function' ? btn(this.context) : btn);\n }\n }\n $group.appendTo($container);\n }\n }\n\n /**\n * @param {jQuery} [$container]\n */\n updateCurrentStyle($container) {\n const $cont = $container || this.$toolbar;\n\n const styleInfo = this.context.invoke('editor.currentStyle');\n this.updateBtnStates($cont, {\n '.note-btn-bold': () => {\n return styleInfo['font-bold'] === 'bold';\n },\n '.note-btn-italic': () => {\n return styleInfo['font-italic'] === 'italic';\n },\n '.note-btn-underline': () => {\n return styleInfo['font-underline'] === 'underline';\n },\n '.note-btn-subscript': () => {\n return styleInfo['font-subscript'] === 'subscript';\n },\n '.note-btn-superscript': () => {\n return styleInfo['font-superscript'] === 'superscript';\n },\n '.note-btn-strikethrough': () => {\n return styleInfo['font-strikethrough'] === 'strikethrough';\n },\n });\n\n if (styleInfo['font-family']) {\n const fontNames = styleInfo['font-family'].split(',').map((name) => {\n return name.replace(/[\\'\\\"]/g, '')\n .replace(/\\s+$/, '')\n .replace(/^\\s+/, '');\n });\n const fontName = lists.find(fontNames, this.isFontInstalled.bind(this));\n\n $cont.find('.dropdown-fontname a').each((idx, item) => {\n const $item = $(item);\n // always compare string to avoid creating another func.\n const isChecked = ($item.data('value') + '') === (fontName + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontname').text(fontName).css('font-family', fontName);\n }\n\n if (styleInfo['font-size']) {\n const fontSize = styleInfo['font-size'];\n $cont.find('.dropdown-fontsize a').each((idx, item) => {\n const $item = $(item);\n // always compare with string to avoid creating another func.\n const isChecked = ($item.data('value') + '') === (fontSize + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontsize').text(fontSize);\n\n const fontSizeUnit = styleInfo['font-size-unit'];\n $cont.find('.dropdown-fontsizeunit a').each((idx, item) => {\n const $item = $(item);\n const isChecked = ($item.data('value') + '') === (fontSizeUnit + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontsizeunit').text(fontSizeUnit);\n }\n\n if (styleInfo['line-height']) {\n const lineHeight = styleInfo['line-height'];\n $cont.find('.dropdown-line-height li a').each((idx, item) => {\n // always compare with string to avoid creating another func.\n const isChecked = ($(item).data('value') + '') === (lineHeight + '');\n this.className = isChecked ? 'checked' : '';\n });\n }\n }\n\n updateBtnStates($container, infos) {\n $.each(infos, (selector, pred) => {\n this.ui.toggleBtnActive($container.find(selector), pred());\n });\n }\n\n tableMoveHandler(event) {\n const PX_PER_EM = 18;\n const $picker = $(event.target.parentNode); // target is mousecatcher\n const $dimensionDisplay = $picker.next();\n const $catcher = $picker.find('.note-dimension-picker-mousecatcher');\n const $highlighted = $picker.find('.note-dimension-picker-highlighted');\n const $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');\n\n let posOffset;\n // HTML5 with jQuery - e.offsetX is undefined in Firefox\n if (event.offsetX === undefined) {\n const posCatcher = $(event.target).offset();\n posOffset = {\n x: event.pageX - posCatcher.left,\n y: event.pageY - posCatcher.top,\n };\n } else {\n posOffset = {\n x: event.offsetX,\n y: event.offsetY,\n };\n }\n\n const dim = {\n c: Math.ceil(posOffset.x / PX_PER_EM) || 1,\n r: Math.ceil(posOffset.y / PX_PER_EM) || 1,\n };\n\n $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' });\n $catcher.data('value', dim.c + 'x' + dim.r);\n\n if (dim.c > 3 && dim.c < this.options.insertTableMaxSize.col) {\n $unhighlighted.css({ width: dim.c + 1 + 'em' });\n }\n\n if (dim.r > 3 && dim.r < this.options.insertTableMaxSize.row) {\n $unhighlighted.css({ height: dim.r + 1 + 'em' });\n }\n\n $dimensionDisplay.html(dim.c + ' x ' + dim.r);\n }\n}\n","import $ from 'jquery';\nexport default class Toolbar {\n constructor(context) {\n this.context = context;\n\n this.$window = $(window);\n this.$document = $(document);\n\n this.ui = $.summernote.ui;\n this.$note = context.layoutInfo.note;\n this.$editor = context.layoutInfo.editor;\n this.$toolbar = context.layoutInfo.toolbar;\n this.$editable = context.layoutInfo.editable;\n this.$statusbar = context.layoutInfo.statusbar;\n this.options = context.options;\n\n this.isFollowing = false;\n this.followScroll = this.followScroll.bind(this);\n }\n\n shouldInitialize() {\n return !this.options.airMode;\n }\n\n initialize() {\n this.options.toolbar = this.options.toolbar || [];\n\n if (!this.options.toolbar.length) {\n this.$toolbar.hide();\n } else {\n this.context.invoke('buttons.build', this.$toolbar, this.options.toolbar);\n }\n\n if (this.options.toolbarContainer) {\n this.$toolbar.appendTo(this.options.toolbarContainer);\n }\n\n this.changeContainer(false);\n\n this.$note.on('summernote.keyup summernote.mouseup summernote.change', () => {\n this.context.invoke('buttons.updateCurrentStyle');\n });\n\n this.context.invoke('buttons.updateCurrentStyle');\n if (this.options.followingToolbar) {\n this.$window.on('scroll resize', this.followScroll);\n }\n }\n\n destroy() {\n this.$toolbar.children().remove();\n\n if (this.options.followingToolbar) {\n this.$window.off('scroll resize', this.followScroll);\n }\n }\n\n followScroll() {\n if (this.$editor.hasClass('fullscreen')) {\n return false;\n }\n\n const editorHeight = this.$editor.outerHeight();\n const editorWidth = this.$editor.width();\n const toolbarHeight = this.$toolbar.height();\n const statusbarHeight = this.$statusbar.height();\n\n // check if the web app is currently using another static bar\n let otherBarHeight = 0;\n if (this.options.otherStaticBar) {\n otherBarHeight = $(this.options.otherStaticBar).outerHeight();\n }\n\n const currentOffset = this.$document.scrollTop();\n const editorOffsetTop = this.$editor.offset().top;\n const editorOffsetBottom = editorOffsetTop + editorHeight;\n const activateOffset = editorOffsetTop - otherBarHeight;\n const deactivateOffsetBottom = editorOffsetBottom - otherBarHeight - toolbarHeight - statusbarHeight;\n\n if (!this.isFollowing &&\n (currentOffset > activateOffset) && (currentOffset < deactivateOffsetBottom - toolbarHeight)) {\n this.isFollowing = true;\n this.$editable.css({\n marginTop: this.$toolbar.outerHeight(),\n });\n this.$toolbar.css({\n position: 'fixed',\n top: otherBarHeight,\n width: editorWidth,\n zIndex: 1000,\n });\n } else if (this.isFollowing &&\n ((currentOffset < activateOffset) || (currentOffset > deactivateOffsetBottom))) {\n this.isFollowing = false;\n this.$toolbar.css({\n position: 'relative',\n top: 0,\n width: '100%',\n zIndex: 'auto',\n });\n this.$editable.css({\n marginTop: '',\n });\n }\n }\n\n changeContainer(isFullscreen) {\n if (isFullscreen) {\n this.$toolbar.prependTo(this.$editor);\n } else {\n if (this.options.toolbarContainer) {\n this.$toolbar.appendTo(this.options.toolbarContainer);\n }\n }\n if (this.options.followingToolbar) {\n this.followScroll();\n }\n }\n\n updateFullscreen(isFullscreen) {\n this.ui.toggleBtnActive(this.$toolbar.find('.btn-fullscreen'), isFullscreen);\n\n this.changeContainer(isFullscreen);\n }\n\n updateCodeview(isCodeview) {\n this.ui.toggleBtnActive(this.$toolbar.find('.btn-codeview'), isCodeview);\n if (isCodeview) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n activate(isIncludeCodeview) {\n let $btn = this.$toolbar.find('button');\n if (!isIncludeCodeview) {\n $btn = $btn.not('.btn-codeview').not('.btn-fullscreen');\n }\n this.ui.toggleBtn($btn, true);\n }\n\n deactivate(isIncludeCodeview) {\n let $btn = this.$toolbar.find('button');\n if (!isIncludeCodeview) {\n $btn = $btn.not('.btn-codeview').not('.btn-fullscreen');\n }\n this.ui.toggleBtn($btn, false);\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\nimport func from '../core/func';\n\nexport default class LinkDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n context.memo('help.linkDialog.show', this.options.langInfo.help['linkDialog.show']);\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group\">',\n `<label for=\"note-dialog-link-txt-${this.options.id}\" class=\"note-form-label\">${this.lang.link.textToDisplay}</label>`,\n `<input id=\"note-dialog-link-txt-${this.options.id}\" class=\"note-link-text form-control note-form-control note-input\" type=\"text\"/>`,\n '</div>',\n '<div class=\"form-group note-form-group\">',\n `<label for=\"note-dialog-link-url-${this.options.id}\" class=\"note-form-label\">${this.lang.link.url}</label>`,\n `<input id=\"note-dialog-link-url-${this.options.id}\" class=\"note-link-url form-control note-form-control note-input\" type=\"text\" value=\"http://\"/>`,\n '</div>',\n !this.options.disableLinkTarget\n ? $('<div/>').append(this.ui.checkbox({\n className: 'sn-checkbox-open-in-new-window',\n text: this.lang.link.openInNewWindow,\n checked: true,\n }).render()).html()\n : '',\n $('<div/>').append(this.ui.checkbox({\n className: 'sn-checkbox-use-protocol',\n text: this.lang.link.useProtocol,\n checked: true,\n }).render()).html(),\n ].join('');\n\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-link-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.link.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n className: 'link-dialog',\n title: this.lang.link.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n /**\n * toggle update button\n */\n toggleLinkBtn($linkBtn, $linkText, $linkUrl) {\n this.ui.toggleBtn($linkBtn, $linkText.val() && $linkUrl.val());\n }\n\n /**\n * Show link dialog and set event handlers on dialog controls.\n *\n * @param {Object} linkInfo\n * @return {Promise}\n */\n showLinkDialog(linkInfo) {\n return $.Deferred((deferred) => {\n const $linkText = this.$dialog.find('.note-link-text');\n const $linkUrl = this.$dialog.find('.note-link-url');\n const $linkBtn = this.$dialog.find('.note-link-btn');\n const $openInNewWindow = this.$dialog\n .find('.sn-checkbox-open-in-new-window input[type=checkbox]');\n const $useProtocol = this.$dialog\n .find('.sn-checkbox-use-protocol input[type=checkbox]');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n // If no url was given and given text is valid URL then copy that into URL Field\n if (!linkInfo.url && func.isValidUrl(linkInfo.text)) {\n linkInfo.url = linkInfo.text;\n }\n\n $linkText.on('input paste propertychange', () => {\n // If linktext was modified by input events,\n // cloning text from linkUrl will be stopped.\n linkInfo.text = $linkText.val();\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n }).val(linkInfo.text);\n\n $linkUrl.on('input paste propertychange', () => {\n // Display same text on `Text to display` as default\n // when linktext has no text\n if (!linkInfo.text) {\n $linkText.val($linkUrl.val());\n }\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n }).val(linkInfo.url);\n\n if (!env.isSupportTouch) {\n $linkUrl.trigger('focus');\n }\n\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n this.bindEnterKey($linkUrl, $linkBtn);\n this.bindEnterKey($linkText, $linkBtn);\n\n const isNewWindowChecked = linkInfo.isNewWindow !== undefined\n ? linkInfo.isNewWindow : this.context.options.linkTargetBlank;\n\n $openInNewWindow.prop('checked', isNewWindowChecked);\n\n const useProtocolChecked = linkInfo.url\n ? false : this.context.options.useProtocol;\n\n $useProtocol.prop('checked', useProtocolChecked);\n\n $linkBtn.one('click', (event) => {\n event.preventDefault();\n\n deferred.resolve({\n range: linkInfo.range,\n url: $linkUrl.val(),\n text: $linkText.val(),\n isNewWindow: $openInNewWindow.is(':checked'),\n checkProtocol: $useProtocol.is(':checked'),\n });\n this.ui.hideDialog(this.$dialog);\n });\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n // detach events\n $linkText.off();\n $linkUrl.off();\n $linkBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n }).promise();\n }\n\n /**\n * @param {Object} layoutInfo\n */\n show() {\n const linkInfo = this.context.invoke('editor.getLinkInfo');\n\n this.context.invoke('editor.saveRange');\n this.showLinkDialog(linkInfo).then((linkInfo) => {\n this.context.invoke('editor.restoreRange');\n this.context.invoke('editor.createLink', linkInfo);\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class LinkPopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.options = context.options;\n this.events = {\n 'summernote.keyup summernote.mouseup summernote.change summernote.scroll': () => {\n this.update();\n },\n 'summernote.disable summernote.dialog.shown summernote.blur': () => {\n this.hide();\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.link);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-link-popover',\n callback: ($node) => {\n const $content = $node.find('.popover-content,.note-popover-content');\n $content.prepend('<span><a target=\"_blank\"></a>&nbsp;</span>');\n },\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.link);\n\n this.$popover.on('mousedown', (e) => { e.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update() {\n // Prevent focusing on editable when invoke('code') is executed\n if (!this.context.invoke('editor.hasFocus')) {\n this.hide();\n return;\n }\n\n const rng = this.context.invoke('editor.getLastRange');\n if (rng.isCollapsed() && rng.isOnAnchor()) {\n const anchor = dom.ancestor(rng.sc, dom.isAnchor);\n const href = $(anchor).attr('href');\n this.$popover.find('a').attr('href', href).text(href);\n\n const pos = dom.posFromPlaceholder(anchor);\n const containerOffset = $(this.options.container).offset();\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\n\nexport default class ImageDialog {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n let imageLimitation = '';\n if (this.options.maximumImageFileSize) {\n const unit = Math.floor(Math.log(this.options.maximumImageFileSize) / Math.log(1024));\n const readableSize = (this.options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 +\n ' ' + ' KMGTP'[unit] + 'B';\n imageLimitation = `<small>${this.lang.image.maximumFileSize + ' : ' + readableSize}</small>`;\n }\n\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group note-group-select-from-files\">',\n '<label for=\"note-dialog-image-file-' + this.options.id + '\" class=\"note-form-label\">' + this.lang.image.selectFromFiles + '</label>',\n '<input id=\"note-dialog-image-file-' + this.options.id + '\" class=\"note-image-input form-control-file note-form-control note-input\" ',\n ' type=\"file\" name=\"files\" accept=\"image/*\" multiple=\"multiple\"/>',\n imageLimitation,\n '</div>',\n '<div class=\"form-group note-group-image-url\">',\n '<label for=\"note-dialog-image-url-' + this.options.id + '\" class=\"note-form-label\">' + this.lang.image.url + '</label>',\n '<input id=\"note-dialog-image-url-' + this.options.id + '\" class=\"note-image-url form-control note-form-control note-input\" type=\"text\"/>',\n '</div>',\n ].join('');\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-image-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.image.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n title: this.lang.image.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n show() {\n this.context.invoke('editor.saveRange');\n this.showImageDialog().then((data) => {\n // [workaround] hide dialog before restore range for IE range focus\n this.ui.hideDialog(this.$dialog);\n this.context.invoke('editor.restoreRange');\n\n if (typeof data === 'string') { // image url\n // If onImageLinkInsert set,\n if (this.options.callbacks.onImageLinkInsert) {\n this.context.triggerEvent('image.link.insert', data);\n } else {\n this.context.invoke('editor.insertImage', data);\n }\n } else { // array of files\n this.context.invoke('editor.insertImagesOrCallback', data);\n }\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n\n /**\n * show image dialog\n *\n * @param {jQuery} $dialog\n * @return {Promise}\n */\n showImageDialog() {\n return $.Deferred((deferred) => {\n const $imageInput = this.$dialog.find('.note-image-input');\n const $imageUrl = this.$dialog.find('.note-image-url');\n const $imageBtn = this.$dialog.find('.note-image-btn');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n // Cloning imageInput to clear element.\n $imageInput.replaceWith($imageInput.clone().on('change', (event) => {\n deferred.resolve(event.target.files || event.target.value);\n }).val(''));\n\n $imageUrl.on('input paste propertychange', () => {\n this.ui.toggleBtn($imageBtn, $imageUrl.val());\n }).val('');\n\n if (!env.isSupportTouch) {\n $imageUrl.trigger('focus');\n }\n\n $imageBtn.click((event) => {\n event.preventDefault();\n deferred.resolve($imageUrl.val());\n });\n\n this.bindEnterKey($imageUrl, $imageBtn);\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n $imageInput.off();\n $imageUrl.off();\n $imageBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\n/**\n * Image popover module\n * mouse events that show/hide popover will be handled by Handle.js.\n * Handle.js will receive the events and invoke 'imagePopover.update'.\n */\nexport default class ImagePopover {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n\n this.editable = context.layoutInfo.editable[0];\n this.options = context.options;\n\n this.events = {\n 'summernote.disable summernote.blur': () => {\n this.hide();\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.image);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-image-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n this.context.invoke('buttons.build', $content, this.options.popover.image);\n\n this.$popover.on('mousedown', (e) => { e.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(target, event) {\n if (dom.isImg(target)) {\n const position = $(target).offset();\n const containerOffset = $(this.options.container).offset();\n let pos = {};\n if (this.options.popatmouse) {\n pos.left = event.pageX - 20;\n pos.top = event.pageY;\n } else {\n pos = position;\n }\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class TablePopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.options = context.options;\n this.events = {\n 'summernote.mousedown': (we, e) => {\n this.update(e.target);\n },\n 'summernote.keyup summernote.scroll summernote.change': () => {\n this.update();\n },\n 'summernote.disable summernote.blur': () => {\n this.hide();\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.table);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-table-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.table);\n\n // [workaround] Disable Firefox's default table editor\n if (env.isFF) {\n document.execCommand('enableInlineTableEditing', false, false);\n }\n\n this.$popover.on('mousedown', (e) => { e.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(target) {\n if (this.context.isDisabled()) {\n return false;\n }\n\n const isCell = dom.isCell(target);\n\n if (isCell) {\n const pos = dom.posFromPlaceholder(target);\n const containerOffset = $(this.options.container).offset();\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n\n return isCell;\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\n\nexport default class VideoDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group row-fluid\">',\n `<label for=\"note-dialog-video-url-${this.options.id}\" class=\"note-form-label\">${this.lang.video.url} <small class=\"text-muted\">${this.lang.video.providers}</small></label>`,\n `<input id=\"note-dialog-video-url-${this.options.id}\" class=\"note-video-url form-control note-form-control note-input\" type=\"text\"/>`,\n '</div>',\n ].join('');\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-video-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.video.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n title: this.lang.video.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n createVideoNode(url) {\n // video url patterns(youtube, instagram, vimeo, dailymotion, youku, mp4, ogg, webm)\n const ytRegExp = /\\/\\/(?:www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))([\\w|-]{11})(?:(?:[\\?&]t=)(\\S+))?$/;\n const ytRegExpForStart = /^(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/;\n const ytMatch = url.match(ytRegExp);\n\n const igRegExp = /(?:www\\.|\\/\\/)instagram\\.com\\/p\\/(.[a-zA-Z0-9_-]*)/;\n const igMatch = url.match(igRegExp);\n\n const vRegExp = /\\/\\/vine\\.co\\/v\\/([a-zA-Z0-9]+)/;\n const vMatch = url.match(vRegExp);\n\n const vimRegExp = /\\/\\/(player\\.)?vimeo\\.com\\/([a-z]*\\/)*(\\d+)[?]?.*/;\n const vimMatch = url.match(vimRegExp);\n\n const dmRegExp = /.+dailymotion.com\\/(video|hub)\\/([^_]+)[^#]*(#video=([^_&]+))?/;\n const dmMatch = url.match(dmRegExp);\n\n const youkuRegExp = /\\/\\/v\\.youku\\.com\\/v_show\\/id_(\\w+)=*\\.html/;\n const youkuMatch = url.match(youkuRegExp);\n\n const qqRegExp = /\\/\\/v\\.qq\\.com.*?vid=(.+)/;\n const qqMatch = url.match(qqRegExp);\n\n const qqRegExp2 = /\\/\\/v\\.qq\\.com\\/x?\\/?(page|cover).*?\\/([^\\/]+)\\.html\\??.*/;\n const qqMatch2 = url.match(qqRegExp2);\n\n const mp4RegExp = /^.+.(mp4|m4v)$/;\n const mp4Match = url.match(mp4RegExp);\n\n const oggRegExp = /^.+.(ogg|ogv)$/;\n const oggMatch = url.match(oggRegExp);\n\n const webmRegExp = /^.+.(webm)$/;\n const webmMatch = url.match(webmRegExp);\n\n const fbRegExp = /(?:www\\.|\\/\\/)facebook\\.com\\/([^\\/]+)\\/videos\\/([0-9]+)/;\n const fbMatch = url.match(fbRegExp);\n\n let $video;\n if (ytMatch && ytMatch[1].length === 11) {\n const youtubeId = ytMatch[1];\n var start = 0;\n if (typeof ytMatch[2] !== 'undefined') {\n const ytMatchForStart = ytMatch[2].match(ytRegExpForStart);\n if (ytMatchForStart) {\n for (var n = [3600, 60, 1], i = 0, r = n.length; i < r; i++) {\n start += (typeof ytMatchForStart[i + 1] !== 'undefined' ? n[i] * parseInt(ytMatchForStart[i + 1], 10) : 0);\n }\n }\n }\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', '//www.youtube.com/embed/' + youtubeId + (start > 0 ? '?start=' + start : ''))\n .attr('width', '640').attr('height', '360');\n } else if (igMatch && igMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', 'https://instagram.com/p/' + igMatch[1] + '/embed/')\n .attr('width', '612').attr('height', '710')\n .attr('scrolling', 'no')\n .attr('allowtransparency', 'true');\n } else if (vMatch && vMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', vMatch[0] + '/embed/simple')\n .attr('width', '600').attr('height', '600')\n .attr('class', 'vine-embed');\n } else if (vimMatch && vimMatch[3].length) {\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('src', '//player.vimeo.com/video/' + vimMatch[3])\n .attr('width', '640').attr('height', '360');\n } else if (dmMatch && dmMatch[2].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2])\n .attr('width', '640').attr('height', '360');\n } else if (youkuMatch && youkuMatch[1].length) {\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('height', '498')\n .attr('width', '510')\n .attr('src', '//player.youku.com/embed/' + youkuMatch[1]);\n } else if ((qqMatch && qqMatch[1].length) || (qqMatch2 && qqMatch2[2].length)) {\n const vid = ((qqMatch && qqMatch[1].length) ? qqMatch[1] : qqMatch2[2]);\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('height', '310')\n .attr('width', '500')\n .attr('src', 'https://v.qq.com/iframe/player.html?vid=' + vid + '&amp;auto=0');\n } else if (mp4Match || oggMatch || webmMatch) {\n $video = $('<video controls>')\n .attr('src', url)\n .attr('width', '640').attr('height', '360');\n } else if (fbMatch && fbMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', 'https://www.facebook.com/plugins/video.php?href=' + encodeURIComponent(fbMatch[0]) + '&show_text=0&width=560')\n .attr('width', '560').attr('height', '301')\n .attr('scrolling', 'no')\n .attr('allowtransparency', 'true');\n } else {\n // this is not a known video link. Now what, Cat? Now what?\n return false;\n }\n\n $video.addClass('note-video-clip');\n\n return $video[0];\n }\n\n show() {\n const text = this.context.invoke('editor.getSelectedText');\n this.context.invoke('editor.saveRange');\n this.showVideoDialog(text).then((url) => {\n // [workaround] hide dialog before restore range for IE range focus\n this.ui.hideDialog(this.$dialog);\n this.context.invoke('editor.restoreRange');\n\n // build node\n const $node = this.createVideoNode(url);\n\n if ($node) {\n // insert video node\n this.context.invoke('editor.insertNode', $node);\n }\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n\n /**\n * show video dialog\n *\n * @param {jQuery} $dialog\n * @return {Promise}\n */\n showVideoDialog(/* text */) {\n return $.Deferred((deferred) => {\n const $videoUrl = this.$dialog.find('.note-video-url');\n const $videoBtn = this.$dialog.find('.note-video-btn');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n $videoUrl.on('input paste propertychange', () => {\n this.ui.toggleBtn($videoBtn, $videoUrl.val());\n });\n\n if (!env.isSupportTouch) {\n $videoUrl.trigger('focus');\n }\n\n $videoBtn.click((event) => {\n event.preventDefault();\n deferred.resolve($videoUrl.val());\n });\n\n this.bindEnterKey($videoUrl, $videoBtn);\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n $videoUrl.off();\n $videoBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n });\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\n\nexport default class HelpDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<p class=\"text-center\">',\n '<a href=\"http://summernote.org/\" target=\"_blank\">Summernote @@VERSION@@</a> · ',\n '<a href=\"https://github.com/summernote/summernote\" target=\"_blank\">Project</a> · ',\n '<a href=\"https://github.com/summernote/summernote/issues\" target=\"_blank\">Issues</a>',\n '</p>',\n ].join('');\n\n this.$dialog = this.ui.dialog({\n title: this.lang.options.help,\n fade: this.options.dialogsFade,\n body: this.createShortcutList(),\n footer: body,\n callback: ($node) => {\n $node.find('.modal-body,.note-modal-body').css({\n 'max-height': 300,\n 'overflow': 'scroll',\n });\n },\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n createShortcutList() {\n const keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];\n return Object.keys(keyMap).map((key) => {\n const command = keyMap[key];\n const $row = $('<div><div class=\"help-list-item\"/></div>');\n $row.append($('<label><kbd>' + key + '</kdb></label>').css({\n 'width': 180,\n 'margin-right': 10,\n })).append($('<span/>').html(this.context.memo('help.' + command) || command));\n return $row.html();\n }).join('');\n }\n\n /**\n * show help dialog\n *\n * @return {Promise}\n */\n showHelpDialog() {\n return $.Deferred((deferred) => {\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n deferred.resolve();\n });\n this.ui.showDialog(this.$dialog);\n }).promise();\n }\n\n show() {\n this.context.invoke('editor.saveRange');\n this.showHelpDialog().then(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\n\nconst AIRMODE_POPOVER_X_OFFSET = -5;\nconst AIRMODE_POPOVER_Y_OFFSET = 5;\n\nexport default class AirPopover {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n this.options = context.options;\n\n this.hidable = true;\n this.onContextmenu = false;\n this.pageX = null;\n this.pageY = null;\n\n this.events = {\n 'summernote.contextmenu': (e) => {\n if (this.options.editing) {\n e.preventDefault();\n e.stopPropagation();\n this.onContextmenu = true;\n this.update(true);\n }\n },\n 'summernote.mousedown': (we, e) => {\n this.pageX = e.pageX;\n this.pageY = e.pageY;\n },\n 'summernote.keyup summernote.mouseup summernote.scroll': (we, e) => {\n if (this.options.editing && !this.onContextmenu) {\n this.pageX = e.pageX;\n this.pageY = e.pageY;\n this.update();\n }\n this.onContextmenu = false;\n },\n 'summernote.disable summernote.change summernote.dialog.shown summernote.blur': () => {\n this.hide();\n },\n 'summernote.focusout': () => {\n if (!this.$popover.is(':active,:focus')) {\n this.hide();\n }\n },\n };\n }\n\n shouldInitialize() {\n return this.options.airMode && !lists.isEmpty(this.options.popover.air);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-air-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.air);\n\n // disable hiding this popover preemptively by 'summernote.blur' event.\n this.$popover.on('mousedown', () => { this.hidable = false; });\n // (re-)enable hiding after 'summernote.blur' has been handled (aka. ignored).\n this.$popover.on('mouseup', () => { this.hidable = true; });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(forcelyOpen) {\n const styleInfo = this.context.invoke('editor.currentStyle');\n if (styleInfo.range && (!styleInfo.range.isCollapsed() || forcelyOpen)) {\n let rect = {\n left: this.pageX,\n top: this.pageY,\n };\n\n const containerOffset = $(this.options.container).offset();\n rect.top -= containerOffset.top;\n rect.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: Math.max(rect.left, 0) + AIRMODE_POPOVER_X_OFFSET,\n top: rect.top + AIRMODE_POPOVER_Y_OFFSET,\n });\n this.context.invoke('buttons.updateCurrentStyle', this.$popover);\n } else {\n this.hide();\n }\n }\n\n hide() {\n if (this.hidable) {\n this.$popover.hide();\n }\n }\n}\n","import $ from 'jquery';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport key from '../core/key';\n\nconst POPOVER_DIST = 5;\n\nexport default class HintPopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.hint = this.options.hint || [];\n this.direction = this.options.hintDirection || 'bottom';\n this.hints = Array.isArray(this.hint) ? this.hint : [this.hint];\n\n this.events = {\n 'summernote.keyup': (we, e) => {\n if (!e.isDefaultPrevented()) {\n this.handleKeyup(e);\n }\n },\n 'summernote.keydown': (we, e) => {\n this.handleKeydown(e);\n },\n 'summernote.disable summernote.dialog.shown summernote.blur': () => {\n this.hide();\n },\n };\n }\n\n shouldInitialize() {\n return this.hints.length > 0;\n }\n\n initialize() {\n this.lastWordRange = null;\n this.matchingWord = null;\n this.$popover = this.ui.popover({\n className: 'note-hint-popover',\n hideArrow: true,\n direction: '',\n }).render().appendTo(this.options.container);\n\n this.$popover.hide();\n this.$content = this.$popover.find('.popover-content,.note-popover-content');\n this.$content.on('click', '.note-hint-item', (e) => {\n this.$content.find('.active').removeClass('active');\n $(e.currentTarget).addClass('active');\n this.replace();\n });\n\n this.$popover.on('mousedown', (e) => { e.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n selectItem($item) {\n this.$content.find('.active').removeClass('active');\n $item.addClass('active');\n\n this.$content[0].scrollTop = $item[0].offsetTop - (this.$content.innerHeight() / 2);\n }\n\n moveDown() {\n const $current = this.$content.find('.note-hint-item.active');\n const $next = $current.next();\n\n if ($next.length) {\n this.selectItem($next);\n } else {\n let $nextGroup = $current.parent().next();\n\n if (!$nextGroup.length) {\n $nextGroup = this.$content.find('.note-hint-group').first();\n }\n\n this.selectItem($nextGroup.find('.note-hint-item').first());\n }\n }\n\n moveUp() {\n const $current = this.$content.find('.note-hint-item.active');\n const $prev = $current.prev();\n\n if ($prev.length) {\n this.selectItem($prev);\n } else {\n let $prevGroup = $current.parent().prev();\n\n if (!$prevGroup.length) {\n $prevGroup = this.$content.find('.note-hint-group').last();\n }\n\n this.selectItem($prevGroup.find('.note-hint-item').last());\n }\n }\n\n replace() {\n const $item = this.$content.find('.note-hint-item.active');\n\n if ($item.length) {\n var node = this.nodeFromItem($item);\n // If matchingWord length = 0 -> capture OK / open hint / but as mention capture \"\" (\\w*)\n if (this.matchingWord !== null && this.matchingWord.length === 0) {\n this.lastWordRange.so = this.lastWordRange.eo;\n // Else si > 0 and normal case -> adjust range \"before\" for correct position of insertion\n } else if (this.matchingWord !== null && this.matchingWord.length > 0 && !this.lastWordRange.isCollapsed()) {\n let rangeCompute = this.lastWordRange.eo - this.lastWordRange.so - this.matchingWord.length;\n if (rangeCompute > 0) {\n this.lastWordRange.so += rangeCompute;\n }\n }\n this.lastWordRange.insertNode(node);\n\n if (this.options.hintSelect === 'next') {\n var blank = document.createTextNode('');\n $(node).after(blank);\n range.createFromNodeBefore(blank).select();\n } else {\n range.createFromNodeAfter(node).select();\n }\n\n this.lastWordRange = null;\n this.hide();\n this.context.invoke('editor.focus');\n }\n }\n\n nodeFromItem($item) {\n const hint = this.hints[$item.data('index')];\n const item = $item.data('item');\n let node = hint.content ? hint.content(item) : item;\n if (typeof node === 'string') {\n node = dom.createText(node);\n }\n return node;\n }\n\n createItemTemplates(hintIdx, items) {\n const hint = this.hints[hintIdx];\n return items.map((item /*, idx */) => {\n const $item = $('<div class=\"note-hint-item\"/>');\n $item.append(hint.template ? hint.template(item) : item + '');\n $item.data({\n 'index': hintIdx,\n 'item': item,\n });\n return $item;\n });\n }\n\n handleKeydown(e) {\n if (!this.$popover.is(':visible')) {\n return;\n }\n\n if (e.keyCode === key.code.ENTER) {\n e.preventDefault();\n this.replace();\n } else if (e.keyCode === key.code.UP) {\n e.preventDefault();\n this.moveUp();\n } else if (e.keyCode === key.code.DOWN) {\n e.preventDefault();\n this.moveDown();\n }\n }\n\n searchKeyword(index, keyword, callback) {\n const hint = this.hints[index];\n if (hint && hint.match.test(keyword) && hint.search) {\n const matches = hint.match.exec(keyword);\n this.matchingWord = matches[0];\n hint.search(matches[1], callback);\n } else {\n callback();\n }\n }\n\n createGroup(idx, keyword) {\n const $group = $('<div class=\"note-hint-group note-hint-group-' + idx + '\"/>');\n this.searchKeyword(idx, keyword, (items) => {\n items = items || [];\n if (items.length) {\n $group.html(this.createItemTemplates(idx, items));\n this.show();\n }\n });\n\n return $group;\n }\n\n handleKeyup(e) {\n if (!lists.contains([key.code.ENTER, key.code.UP, key.code.DOWN], e.keyCode)) {\n let range = this.context.invoke('editor.getLastRange');\n let wordRange, keyword;\n if (this.options.hintMode === 'words') {\n wordRange = range.getWordsRange(range);\n keyword = wordRange.toString();\n\n this.hints.forEach((hint) => {\n if (hint.match.test(keyword)) {\n wordRange = range.getWordsMatchRange(hint.match);\n return false;\n }\n });\n\n if (!wordRange) {\n this.hide();\n return;\n }\n\n keyword = wordRange.toString();\n } else {\n wordRange = range.getWordRange();\n keyword = wordRange.toString();\n }\n\n if (this.hints.length && keyword) {\n this.$content.empty();\n\n const bnd = func.rect2bnd(lists.last(wordRange.getClientRects()));\n const containerOffset = $(this.options.container).offset();\n if (bnd) {\n bnd.top -= containerOffset.top;\n bnd.left -= containerOffset.left;\n\n this.$popover.hide();\n this.lastWordRange = wordRange;\n this.hints.forEach((hint, idx) => {\n if (hint.match.test(keyword)) {\n this.createGroup(idx, keyword).appendTo(this.$content);\n }\n });\n // select first .note-hint-item\n this.$content.find('.note-hint-item:first').addClass('active');\n\n // set position for popover after group is created\n if (this.direction === 'top') {\n this.$popover.css({\n left: bnd.left,\n top: bnd.top - this.$popover.outerHeight() - POPOVER_DIST,\n });\n } else {\n this.$popover.css({\n left: bnd.left,\n top: bnd.top + bnd.height + POPOVER_DIST,\n });\n }\n }\n } else {\n this.hide();\n }\n }\n }\n\n show() {\n this.$popover.show();\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport './summernote-en-US';\nimport '../summernote';\nimport dom from './core/dom';\nimport range from './core/range';\nimport lists from './core/lists';\nimport Editor from './module/Editor';\nimport Clipboard from './module/Clipboard';\nimport Dropzone from './module/Dropzone';\nimport Codeview from './module/Codeview';\nimport Statusbar from './module/Statusbar';\nimport Fullscreen from './module/Fullscreen';\nimport Handle from './module/Handle';\nimport AutoLink from './module/AutoLink';\nimport AutoSync from './module/AutoSync';\nimport AutoReplace from './module/AutoReplace';\nimport Placeholder from './module/Placeholder';\nimport Buttons from './module/Buttons';\nimport Toolbar from './module/Toolbar';\nimport LinkDialog from './module/LinkDialog';\nimport LinkPopover from './module/LinkPopover';\nimport ImageDialog from './module/ImageDialog';\nimport ImagePopover from './module/ImagePopover';\nimport TablePopover from './module/TablePopover';\nimport VideoDialog from './module/VideoDialog';\nimport HelpDialog from './module/HelpDialog';\nimport AirPopover from './module/AirPopover';\nimport HintPopover from './module/HintPopover';\n\n$.summernote = $.extend($.summernote, {\n version: '@@VERSION@@',\n plugins: {},\n\n dom: dom,\n range: range,\n lists: lists,\n\n options: {\n langInfo: $.summernote.lang['en-US'],\n editing: true,\n modules: {\n 'editor': Editor,\n 'clipboard': Clipboard,\n 'dropzone': Dropzone,\n 'codeview': Codeview,\n 'statusbar': Statusbar,\n 'fullscreen': Fullscreen,\n 'handle': Handle,\n // FIXME: HintPopover must be front of autolink\n // - Script error about range when Enter key is pressed on hint popover\n 'hintPopover': HintPopover,\n 'autoLink': AutoLink,\n 'autoSync': AutoSync,\n 'autoReplace': AutoReplace,\n 'placeholder': Placeholder,\n 'buttons': Buttons,\n 'toolbar': Toolbar,\n 'linkDialog': LinkDialog,\n 'linkPopover': LinkPopover,\n 'imageDialog': ImageDialog,\n 'imagePopover': ImagePopover,\n 'tablePopover': TablePopover,\n 'videoDialog': VideoDialog,\n 'helpDialog': HelpDialog,\n 'airPopover': AirPopover,\n },\n\n buttons: {},\n\n lang: 'en-US',\n\n followingToolbar: false,\n toolbarPosition: 'top',\n otherStaticBar: '',\n\n // toolbar\n toolbar: [\n ['style', ['style']],\n ['font', ['bold', 'underline', 'clear']],\n ['fontname', ['fontname']],\n ['color', ['color']],\n ['para', ['ul', 'ol', 'paragraph']],\n ['table', ['table']],\n ['insert', ['link', 'picture', 'video']],\n ['view', ['fullscreen', 'codeview', 'help']],\n ],\n\n // popover\n popatmouse: true,\n popover: {\n image: [\n ['resize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],\n ['float', ['floatLeft', 'floatRight', 'floatNone']],\n ['remove', ['removeMedia']],\n ],\n link: [\n ['link', ['linkDialogShow', 'unlink']],\n ],\n table: [\n ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],\n ['delete', ['deleteRow', 'deleteCol', 'deleteTable']],\n ],\n air: [\n ['color', ['color']],\n ['font', ['bold', 'underline', 'clear']],\n ['para', ['ul', 'paragraph']],\n ['table', ['table']],\n ['insert', ['link', 'picture']],\n ['view', ['fullscreen', 'codeview']],\n ],\n },\n\n // air mode: inline editor\n airMode: false,\n overrideContextMenu: false, // TBD\n\n width: null,\n height: null,\n linkTargetBlank: true,\n useProtocol: true,\n defaultProtocol: 'http://',\n\n focus: false,\n tabDisabled: false,\n tabSize: 4,\n styleWithCSS: false,\n shortcuts: true,\n textareaAutoSync: true,\n tooltip: 'auto',\n container: null,\n maxTextLength: 0,\n blockquoteBreakingLevel: 2,\n spellCheck: true,\n disableGrammar: false,\n placeholder: null,\n inheritPlaceholder: false,\n // TODO: need to be documented\n recordEveryKeystroke: false,\n historyLimit: 200,\n\n // TODO: need to be documented\n hintMode: 'word',\n hintSelect: 'after',\n hintDirection: 'bottom',\n\n styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],\n\n fontNames: [\n 'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New',\n 'Helvetica Neue', 'Helvetica', 'Impact', 'Lucida Grande',\n 'Tahoma', 'Times New Roman', 'Verdana',\n ],\n fontNamesIgnoreCheck: [],\n addDefaultFonts: true,\n\n fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'],\n\n fontSizeUnits: ['px', 'pt'],\n\n // pallete colors(n x n)\n colors: [\n ['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'],\n ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'],\n ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'],\n ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'],\n ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'],\n ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'],\n ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'],\n ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031'],\n ],\n\n // http://chir.ag/projects/name-that-color/\n colorsName: [\n ['Black', 'Tundora', 'Dove Gray', 'Star Dust', 'Pale Slate', 'Gallery', 'Alabaster', 'White'],\n ['Red', 'Orange Peel', 'Yellow', 'Green', 'Cyan', 'Blue', 'Electric Violet', 'Magenta'],\n ['Azalea', 'Karry', 'Egg White', 'Zanah', 'Botticelli', 'Tropical Blue', 'Mischka', 'Twilight'],\n ['Tonys Pink', 'Peach Orange', 'Cream Brulee', 'Sprout', 'Casper', 'Perano', 'Cold Purple', 'Careys Pink'],\n ['Mandy', 'Rajah', 'Dandelion', 'Olivine', 'Gulf Stream', 'Viking', 'Blue Marguerite', 'Puce'],\n ['Guardsman Red', 'Fire Bush', 'Golden Dream', 'Chelsea Cucumber', 'Smalt Blue', 'Boston Blue', 'Butterfly Bush', 'Cadillac'],\n ['Sangria', 'Mai Tai', 'Buddha Gold', 'Forest Green', 'Eden', 'Venice Blue', 'Meteorite', 'Claret'],\n ['Rosewood', 'Cinnamon', 'Olive', 'Parsley', 'Tiber', 'Midnight Blue', 'Valentino', 'Loulou'],\n ],\n\n colorButton: {\n foreColor: '#000000',\n backColor: '#FFFF00',\n },\n\n lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],\n\n tableClassName: 'table table-bordered',\n\n insertTableMaxSize: {\n col: 10,\n row: 10,\n },\n\n // By default, dialogs are attached in container.\n dialogsInBody: false,\n dialogsFade: false,\n\n maximumImageFileSize: null,\n\n callbacks: {\n onBeforeCommand: null,\n onBlur: null,\n onBlurCodeview: null,\n onChange: null,\n onChangeCodeview: null,\n onDialogShown: null,\n onEnter: null,\n onFocus: null,\n onImageLinkInsert: null,\n onImageUpload: null,\n onImageUploadError: null,\n onInit: null,\n onKeydown: null,\n onKeyup: null,\n onMousedown: null,\n onMouseup: null,\n onPaste: null,\n onScroll: null,\n },\n\n codemirror: {\n mode: 'text/html',\n htmlMode: true,\n lineNumbers: true,\n },\n\n codeviewFilter: false,\n codeviewFilterRegex: /<\\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,\n codeviewIframeFilter: true,\n codeviewIframeWhitelistSrc: [],\n codeviewIframeWhitelistSrcBase: [\n 'www.youtube.com',\n 'www.youtube-nocookie.com',\n 'www.facebook.com',\n 'vine.co',\n 'instagram.com',\n 'player.vimeo.com',\n 'www.dailymotion.com',\n 'player.youku.com',\n 'v.qq.com',\n ],\n\n keyMap: {\n pc: {\n 'ENTER': 'insertParagraph',\n 'CTRL+Z': 'undo',\n 'CTRL+Y': 'redo',\n 'TAB': 'tab',\n 'SHIFT+TAB': 'untab',\n 'CTRL+B': 'bold',\n 'CTRL+I': 'italic',\n 'CTRL+U': 'underline',\n 'CTRL+SHIFT+S': 'strikethrough',\n 'CTRL+BACKSLASH': 'removeFormat',\n 'CTRL+SHIFT+L': 'justifyLeft',\n 'CTRL+SHIFT+E': 'justifyCenter',\n 'CTRL+SHIFT+R': 'justifyRight',\n 'CTRL+SHIFT+J': 'justifyFull',\n 'CTRL+SHIFT+NUM7': 'insertUnorderedList',\n 'CTRL+SHIFT+NUM8': 'insertOrderedList',\n 'CTRL+LEFTBRACKET': 'outdent',\n 'CTRL+RIGHTBRACKET': 'indent',\n 'CTRL+NUM0': 'formatPara',\n 'CTRL+NUM1': 'formatH1',\n 'CTRL+NUM2': 'formatH2',\n 'CTRL+NUM3': 'formatH3',\n 'CTRL+NUM4': 'formatH4',\n 'CTRL+NUM5': 'formatH5',\n 'CTRL+NUM6': 'formatH6',\n 'CTRL+ENTER': 'insertHorizontalRule',\n 'CTRL+K': 'linkDialog.show',\n },\n\n mac: {\n 'ENTER': 'insertParagraph',\n 'CMD+Z': 'undo',\n 'CMD+SHIFT+Z': 'redo',\n 'TAB': 'tab',\n 'SHIFT+TAB': 'untab',\n 'CMD+B': 'bold',\n 'CMD+I': 'italic',\n 'CMD+U': 'underline',\n 'CMD+SHIFT+S': 'strikethrough',\n 'CMD+BACKSLASH': 'removeFormat',\n 'CMD+SHIFT+L': 'justifyLeft',\n 'CMD+SHIFT+E': 'justifyCenter',\n 'CMD+SHIFT+R': 'justifyRight',\n 'CMD+SHIFT+J': 'justifyFull',\n 'CMD+SHIFT+NUM7': 'insertUnorderedList',\n 'CMD+SHIFT+NUM8': 'insertOrderedList',\n 'CMD+LEFTBRACKET': 'outdent',\n 'CMD+RIGHTBRACKET': 'indent',\n 'CMD+NUM0': 'formatPara',\n 'CMD+NUM1': 'formatH1',\n 'CMD+NUM2': 'formatH2',\n 'CMD+NUM3': 'formatH3',\n 'CMD+NUM4': 'formatH4',\n 'CMD+NUM5': 'formatH5',\n 'CMD+NUM6': 'formatH6',\n 'CMD+ENTER': 'insertHorizontalRule',\n 'CMD+K': 'linkDialog.show',\n },\n },\n icons: {\n 'align': 'note-icon-align',\n 'alignCenter': 'note-icon-align-center',\n 'alignJustify': 'note-icon-align-justify',\n 'alignLeft': 'note-icon-align-left',\n 'alignRight': 'note-icon-align-right',\n 'rowBelow': 'note-icon-row-below',\n 'colBefore': 'note-icon-col-before',\n 'colAfter': 'note-icon-col-after',\n 'rowAbove': 'note-icon-row-above',\n 'rowRemove': 'note-icon-row-remove',\n 'colRemove': 'note-icon-col-remove',\n 'indent': 'note-icon-align-indent',\n 'outdent': 'note-icon-align-outdent',\n 'arrowsAlt': 'note-icon-arrows-alt',\n 'bold': 'note-icon-bold',\n 'caret': 'note-icon-caret',\n 'circle': 'note-icon-circle',\n 'close': 'note-icon-close',\n 'code': 'note-icon-code',\n 'eraser': 'note-icon-eraser',\n 'floatLeft': 'note-icon-float-left',\n 'floatRight': 'note-icon-float-right',\n 'font': 'note-icon-font',\n 'frame': 'note-icon-frame',\n 'italic': 'note-icon-italic',\n 'link': 'note-icon-link',\n 'unlink': 'note-icon-chain-broken',\n 'magic': 'note-icon-magic',\n 'menuCheck': 'note-icon-menu-check',\n 'minus': 'note-icon-minus',\n 'orderedlist': 'note-icon-orderedlist',\n 'pencil': 'note-icon-pencil',\n 'picture': 'note-icon-picture',\n 'question': 'note-icon-question',\n 'redo': 'note-icon-redo',\n 'rollback': 'note-icon-rollback',\n 'square': 'note-icon-square',\n 'strikethrough': 'note-icon-strikethrough',\n 'subscript': 'note-icon-subscript',\n 'superscript': 'note-icon-superscript',\n 'table': 'note-icon-table',\n 'textHeight': 'note-icon-text-height',\n 'trash': 'note-icon-trash',\n 'underline': 'note-icon-underline',\n 'undo': 'note-icon-undo',\n 'unorderedlist': 'note-icon-unorderedlist',\n 'video': 'note-icon-video',\n },\n },\n});\n","import $ from 'jquery';\n\nclass TooltipUI {\n constructor($node, options) {\n this.$node = $node;\n this.options = $.extend({}, {\n title: '',\n target: options.container,\n trigger: 'hover focus',\n placement: 'bottom',\n }, options);\n\n // create tooltip node\n this.$tooltip = $([\n '<div class=\"note-tooltip\">',\n '<div class=\"note-tooltip-arrow\"/>',\n '<div class=\"note-tooltip-content\"/>',\n '</div>',\n ].join(''));\n\n // define event\n if (this.options.trigger !== 'manual') {\n const showCallback = this.show.bind(this);\n const hideCallback = this.hide.bind(this);\n const toggleCallback = this.toggle.bind(this);\n\n this.options.trigger.split(' ').forEach(function(eventName) {\n if (eventName === 'hover') {\n $node.off('mouseenter mouseleave');\n $node.on('mouseenter', showCallback).on('mouseleave', hideCallback);\n } else if (eventName === 'click') {\n $node.on('click', toggleCallback);\n } else if (eventName === 'focus') {\n $node.on('focus', showCallback).on('blur', hideCallback);\n }\n });\n }\n }\n\n show() {\n const $node = this.$node;\n const offset = $node.offset();\n const targetOffset = $(this.options.target).offset();\n offset.top -= targetOffset.top;\n offset.left -= targetOffset.left;\n\n const $tooltip = this.$tooltip;\n const title = this.options.title || $node.attr('title') || $node.data('title');\n const placement = this.options.placement || $node.data('placement');\n\n $tooltip.addClass(placement);\n $tooltip.find('.note-tooltip-content').text(title);\n $tooltip.appendTo(this.options.target);\n\n const nodeWidth = $node.outerWidth();\n const nodeHeight = $node.outerHeight();\n const tooltipWidth = $tooltip.outerWidth();\n const tooltipHeight = $tooltip.outerHeight();\n\n if (placement === 'bottom') {\n $tooltip.css({\n top: offset.top + nodeHeight,\n left: offset.left + (nodeWidth / 2 - tooltipWidth / 2),\n });\n } else if (placement === 'top') {\n $tooltip.css({\n top: offset.top - tooltipHeight,\n left: offset.left + (nodeWidth / 2 - tooltipWidth / 2),\n });\n } else if (placement === 'left') {\n $tooltip.css({\n top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),\n left: offset.left - tooltipWidth,\n });\n } else if (placement === 'right') {\n $tooltip.css({\n top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),\n left: offset.left + nodeWidth,\n });\n }\n\n $tooltip.addClass('in');\n }\n\n hide() {\n this.$tooltip.removeClass('in');\n setTimeout(() => {\n this.$tooltip.remove();\n }, 200);\n }\n\n toggle() {\n if (this.$tooltip.hasClass('in')) {\n this.hide();\n } else {\n this.show();\n }\n }\n}\n\nexport default TooltipUI;\n","import $ from 'jquery';\n\nclass DropdownUI {\n constructor($node, options) {\n this.$button = $node;\n this.options = $.extend({}, {\n target: options.container,\n }, options);\n this.setEvent();\n }\n\n setEvent() {\n this.$button.on('click', (e) => {\n this.toggle();\n e.stopImmediatePropagation();\n });\n }\n\n clear() {\n var $parent = $('.note-btn-group.open');\n $parent.find('.note-btn.active').removeClass('active');\n $parent.removeClass('open');\n }\n\n show() {\n this.$button.addClass('active');\n this.$button.parent().addClass('open');\n\n var $dropdown = this.$button.next();\n var offset = $dropdown.offset();\n var width = $dropdown.outerWidth();\n var windowWidth = $(window).width();\n var targetMarginRight = parseFloat($(this.options.target).css('margin-right'));\n\n if (offset.left + width > windowWidth - targetMarginRight) {\n $dropdown.css('margin-left', windowWidth - targetMarginRight - (offset.left + width));\n } else {\n $dropdown.css('margin-left', '');\n }\n }\n\n hide() {\n this.$button.removeClass('active');\n this.$button.parent().removeClass('open');\n }\n\n toggle() {\n var isOpened = this.$button.parent().hasClass('open');\n\n this.clear();\n\n if (isOpened) {\n this.hide();\n } else {\n this.show();\n }\n }\n}\n\n$(document).on('click', function(e) {\n if (!$(e.target).closest('.note-btn-group').length) {\n $('.note-btn-group.open').removeClass('open');\n $('.note-btn-group .note-btn.active').removeClass('active');\n }\n});\n\n$(document).on('click.note-dropdown-menu', function(e) {\n $(e.target).closest('.note-dropdown-menu').parent().removeClass('open');\n $(e.target).closest('.note-dropdown-menu').parent().find('.note-btn.active').removeClass('active');\n});\n\nexport default DropdownUI;\n","import $ from 'jquery';\n\nclass ModalUI {\n constructor($node /*, options */) {\n this.$modal = $node;\n this.$backdrop = $('<div class=\"note-modal-backdrop\"/>');\n }\n\n show() {\n this.$backdrop.appendTo(document.body).show();\n this.$modal.addClass('open').show();\n this.$modal.trigger('note.modal.show');\n this.$modal.off('click', '.close').on('click', '.close', this.hide.bind(this));\n this.$modal.on('keydown', (event) => {\n if (event.which === 27) {\n event.preventDefault();\n this.hide();\n }\n });\n }\n\n hide() {\n this.$modal.removeClass('open').hide();\n this.$backdrop.hide();\n this.$modal.trigger('note.modal.hide');\n this.$modal.off('keydown');\n }\n}\n\nexport default ModalUI;\n","import $ from 'jquery';\nimport renderer from '../base/renderer';\nimport TooltipUI from './ui/TooltipUI';\nimport DropdownUI from './ui/DropdownUI';\nimport ModalUI from './ui/ModalUI';\n\nconst editor = renderer.create('<div class=\"note-editor note-frame\"/>');\nconst toolbar = renderer.create('<div class=\"note-toolbar\" role=\"toolbar\"/>');\nconst editingArea = renderer.create('<div class=\"note-editing-area\"/>');\nconst codable = renderer.create('<textarea class=\"note-codable\" aria-multiline=\"true\"/>');\nconst editable = renderer.create('<div class=\"note-editable\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"/>');\nconst statusbar = renderer.create([\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"/>',\n '<div class=\"note-statusbar\" role=\"status\">',\n '<div class=\"note-resizebar\" aria-label=\"resize\">',\n '<div class=\"note-icon-bar\"/>',\n '<div class=\"note-icon-bar\"/>',\n '<div class=\"note-icon-bar\"/>',\n '</div>',\n '</div>',\n].join(''));\n\nconst airEditor = renderer.create('<div class=\"note-editor note-airframe\"/>');\nconst airEditable = renderer.create([\n '<div class=\"note-editable\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"/>',\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"/>',\n].join(''));\n\nconst buttonGroup = renderer.create('<div class=\"note-btn-group\">');\nconst button = renderer.create('<button type=\"button\" class=\"note-btn\" tabindex=\"-1\">', function($node, options) {\n // set button type\n if (options && options.tooltip) {\n $node.attr({\n 'aria-label': options.tooltip,\n });\n $node.data('_lite_tooltip', new TooltipUI($node, {\n title: options.tooltip,\n container: options.container,\n })).on('click', (e) => {\n $(e.currentTarget).data('_lite_tooltip').hide();\n });\n }\n if (options.contents) {\n $node.html(options.contents);\n }\n\n if (options && options.data && options.data.toggle === 'dropdown') {\n $node.data('_lite_dropdown', new DropdownUI($node, {\n container: options.container,\n }));\n }\n});\n\nconst dropdown = renderer.create('<div class=\"note-dropdown-menu\" role=\"list\">', function($node, options) {\n const markup = Array.isArray(options.items) ? options.items.map(function(item) {\n const value = (typeof item === 'string') ? item : (item.value || '');\n const content = options.template ? options.template(item) : item;\n const $temp = $('<a class=\"note-dropdown-item\" href=\"#\" data-value=\"' + value + '\" role=\"listitem\" aria-label=\"' + value + '\"></a>');\n\n $temp.html(content).data('item', item);\n\n return $temp;\n }) : options.items;\n\n $node.html(markup).attr({ 'aria-label': options.title });\n\n $node.on('click', '> .note-dropdown-item', function(e) {\n const $a = $(this);\n\n const item = $a.data('item');\n const value = $a.data('value');\n\n if (item.click) {\n item.click($a);\n } else if (options.itemClick) {\n options.itemClick(e, item, value);\n }\n });\n});\n\nconst dropdownCheck = renderer.create('<div class=\"note-dropdown-menu note-check\" role=\"list\">', function($node, options) {\n const markup = Array.isArray(options.items) ? options.items.map(function(item) {\n const value = (typeof item === 'string') ? item : (item.value || '');\n const content = options.template ? options.template(item) : item;\n\n const $temp = $('<a class=\"note-dropdown-item\" href=\"#\" data-value=\"' + value + '\" role=\"listitem\" aria-label=\"' + item + '\"></a>');\n $temp.html([icon(options.checkClassName), ' ', content]).data('item', item);\n return $temp;\n }) : options.items;\n\n $node.html(markup).attr({ 'aria-label': options.title });\n\n $node.on('click', '> .note-dropdown-item', function(e) {\n const $a = $(this);\n\n const item = $a.data('item');\n const value = $a.data('value');\n\n if (item.click) {\n item.click($a);\n } else if (options.itemClick) {\n options.itemClick(e, item, value);\n }\n });\n});\n\nconst dropdownButtonContents = function(contents, options) {\n return contents + ' ' + icon(options.icons.caret, 'span');\n};\n\nconst dropdownButton = function(opt, callback) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\n className: opt.className,\n items: opt.items,\n template: opt.template,\n itemClick: opt.itemClick,\n }),\n ], { callback: callback }).render();\n};\n\nconst dropdownCheckButton = function(opt, callback) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdownCheck({\n className: opt.className,\n checkClassName: opt.checkClassName,\n items: opt.items,\n template: opt.template,\n itemClick: opt.itemClick,\n }),\n ], { callback: callback }).render();\n};\n\nconst paragraphDropdownButton = function(opt) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown([\n buttonGroup({\n className: 'note-align',\n children: opt.items[0],\n }),\n buttonGroup({\n className: 'note-list',\n children: opt.items[1],\n }),\n ]),\n ]).render();\n};\n\nconst tableMoveHandler = function(event, col, row) {\n const PX_PER_EM = 18;\n const $picker = $(event.target.parentNode); // target is mousecatcher\n const $dimensionDisplay = $picker.next();\n const $catcher = $picker.find('.note-dimension-picker-mousecatcher');\n const $highlighted = $picker.find('.note-dimension-picker-highlighted');\n const $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');\n\n let posOffset;\n // HTML5 with jQuery - e.offsetX is undefined in Firefox\n if (event.offsetX === undefined) {\n const posCatcher = $(event.target).offset();\n posOffset = {\n x: event.pageX - posCatcher.left,\n y: event.pageY - posCatcher.top,\n };\n } else {\n posOffset = {\n x: event.offsetX,\n y: event.offsetY,\n };\n }\n\n const dim = {\n c: Math.ceil(posOffset.x / PX_PER_EM) || 1,\n r: Math.ceil(posOffset.y / PX_PER_EM) || 1,\n };\n\n $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' });\n $catcher.data('value', dim.c + 'x' + dim.r);\n\n if (dim.c > 3 && dim.c < col) {\n $unhighlighted.css({ width: dim.c + 1 + 'em' });\n }\n\n if (dim.r > 3 && dim.r < row) {\n $unhighlighted.css({ height: dim.r + 1 + 'em' });\n }\n\n $dimensionDisplay.html(dim.c + ' x ' + dim.r);\n};\n\nconst tableDropdownButton = function(opt) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\n className: 'note-table',\n items: [\n '<div class=\"note-dimension-picker\">',\n '<div class=\"note-dimension-picker-mousecatcher\" data-event=\"insertTable\" data-value=\"1x1\"/>',\n '<div class=\"note-dimension-picker-highlighted\"/>',\n '<div class=\"note-dimension-picker-unhighlighted\"/>',\n '</div>',\n '<div class=\"note-dimension-display\">1 x 1</div>',\n ].join(''),\n }),\n ], {\n callback: function($node) {\n const $catcher = $node.find('.note-dimension-picker-mousecatcher');\n $catcher.css({\n width: opt.col + 'em',\n height: opt.row + 'em',\n })\n .mousedown(opt.itemClick)\n .mousemove(function(e) {\n tableMoveHandler(e, opt.col, opt.row);\n });\n },\n }).render();\n};\n\nconst palette = renderer.create('<div class=\"note-color-palette\"/>', function($node, options) {\n const contents = [];\n for (let row = 0, rowSize = options.colors.length; row < rowSize; row++) {\n const eventName = options.eventName;\n const colors = options.colors[row];\n const colorsName = options.colorsName[row];\n const buttons = [];\n for (let col = 0, colSize = colors.length; col < colSize; col++) {\n const color = colors[col];\n const colorName = colorsName[col];\n buttons.push([\n '<button type=\"button\" class=\"note-btn note-color-btn\"',\n 'style=\"background-color:', color, '\" ',\n 'data-event=\"', eventName, '\" ',\n 'data-value=\"', color, '\" ',\n 'data-title=\"', colorName, '\" ',\n 'aria-label=\"', colorName, '\" ',\n 'data-toggle=\"button\" tabindex=\"-1\"></button>',\n ].join(''));\n }\n contents.push('<div class=\"note-color-row\">' + buttons.join('') + '</div>');\n }\n $node.html(contents.join(''));\n\n $node.find('.note-color-btn').each(function() {\n $(this).data('_lite_tooltip', new TooltipUI($(this), {\n container: options.container,\n }));\n });\n});\n\nconst colorDropdownButton = function(opt, type) {\n return buttonGroup({\n className: 'note-color',\n children: [\n button({\n className: 'note-current-color-button',\n contents: opt.title,\n tooltip: opt.lang.color.recent,\n click: opt.currentClick,\n callback: function($button) {\n const $recentColor = $button.find('.note-recent-color');\n\n if (type !== 'foreColor') {\n $recentColor.css('background-color', '#FFFF00');\n $button.attr('data-backColor', '#FFFF00');\n }\n },\n }),\n button({\n className: 'dropdown-toggle',\n contents: icon('note-icon-caret'),\n tooltip: opt.lang.color.more,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\n items: [\n '<div>',\n '<div class=\"note-btn-group btn-background-color\">',\n '<div class=\"note-palette-title\">' + opt.lang.color.background + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset note-btn note-btn-block\" data-event=\"backColor\" data-value=\"inherit\">',\n opt.lang.color.transparent,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"backColor\"/>',\n '<div class=\"btn-sm\">',\n '<input type=\"color\" id=\"html5bcp\" class=\"note-btn btn-default\" value=\"#21104A\" style=\"width:100%;\" data-value=\"cp\">',\n '<button type=\"button\" class=\"note-color-reset btn\" data-event=\"backColor\" data-value=\"cpbackColor\">',\n opt.lang.color.cpSelect,\n '</button>',\n '</div>',\n '</div>',\n '<div class=\"note-btn-group btn-foreground-color\">',\n '<div class=\"note-palette-title\">' + opt.lang.color.foreground + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset note-btn note-btn-block\" data-event=\"removeFormat\" data-value=\"foreColor\">',\n opt.lang.color.resetToDefault,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"foreColor\"/>',\n '<div class=\"btn-sm\">',\n '<input type=\"color\" id=\"html5fcp\" class=\"note-btn btn-default\" value=\"#21104A\" style=\"width:100%;\" data-value=\"cp\">',\n '<button type=\"button\" class=\"note-color-reset btn\" data-event=\"foreColor\" data-value=\"cpforeColor\">',\n opt.lang.color.cpSelect,\n '</button>',\n '</div>',\n '</div>',\n '</div>',\n ].join(''),\n callback: function($dropdown) {\n $dropdown.find('.note-holder').each(function() {\n const $holder = $(this);\n $holder.append(palette({\n colors: opt.colors,\n eventName: $holder.data('event'),\n }).render());\n });\n\n if (type === 'fore') {\n $dropdown.find('.btn-background-color').hide();\n $dropdown.css({ 'min-width': '210px' });\n } else if (type === 'back') {\n $dropdown.find('.btn-foreground-color').hide();\n $dropdown.css({ 'min-width': '210px' });\n }\n },\n click: function(event) {\n const $button = $(event.target);\n const eventName = $button.data('event');\n let value = $button.data('value');\n const foreinput = document.getElementById('html5fcp').value;\n const backinput = document.getElementById('html5bcp').value;\n if (value === 'cp') {\n event.stopPropagation();\n } else if (value === 'cpbackColor') {\n value = backinput;\n } else if (value === 'cpforeColor') {\n value = foreinput;\n }\n\n if (eventName && value) {\n const key = eventName === 'backColor' ? 'background-color' : 'color';\n const $color = $button.closest('.note-color').find('.note-recent-color');\n const $currentButton = $button.closest('.note-color').find('.note-current-color-button');\n\n $color.css(key, value);\n $currentButton.attr('data-' + eventName, value);\n\n if (type === 'fore') {\n opt.itemClick('foreColor', value);\n } else if (type === 'back') {\n opt.itemClick('backColor', value);\n } else {\n opt.itemClick(eventName, value);\n }\n }\n },\n }),\n ],\n }).render();\n};\n\nconst dialog = renderer.create('<div class=\"note-modal\" aria-hidden=\"false\" tabindex=\"-1\" role=\"dialog\"/>', function($node, options) {\n if (options.fade) {\n $node.addClass('fade');\n }\n $node.attr({\n 'aria-label': options.title,\n });\n $node.html([\n '<div class=\"note-modal-content\">',\n (options.title ? '<div class=\"note-modal-header\"><button type=\"button\" class=\"close\" aria-label=\"Close\" aria-hidden=\"true\"><i class=\"note-icon-close\"></i></button><h4 class=\"note-modal-title\">' + options.title + '</h4></div>' : ''),\n '<div class=\"note-modal-body\">' + options.body + '</div>',\n (options.footer ? '<div class=\"note-modal-footer\">' + options.footer + '</div>' : ''),\n '</div>',\n ].join(''));\n\n $node.data('modal', new ModalUI($node, options));\n});\n\nconst videoDialog = function(opt) {\n const body = '<div class=\"note-form-group\">' +\n '<label for=\"note-dialog-video-url-' + opt.id + '\" class=\"note-form-label\">' + opt.lang.video.url + ' <small class=\"text-muted\">' + opt.lang.video.providers + '</small></label>' +\n '<input id=\"note-dialog-video-url-' + opt.id + '\" class=\"note-video-url note-input\" type=\"text\"/>' +\n '</div>';\n const footer = [\n '<button type=\"button\" href=\"#\" class=\"note-btn note-btn-primary note-video-btn disabled\" disabled>',\n opt.lang.video.insert,\n '</button>',\n ].join('');\n\n return dialog({\n title: opt.lang.video.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst imageDialog = function(opt) {\n const body = '<div class=\"note-form-group note-group-select-from-files\">' +\n '<label for=\"note-dialog-image-file-' + opt.id + '\" class=\"note-form-label\">' + opt.lang.image.selectFromFiles + '</label>' +\n '<input id=\"note-dialog-image-file-' + opt.id + '\" class=\"note-note-image-input note-input\" type=\"file\" name=\"files\" accept=\"image/*\" multiple=\"multiple\"/>' +\n opt.imageLimitation +\n '</div>' +\n '<div class=\"note-form-group\">' +\n '<label for=\"note-dialog-image-url-' + opt.id + '\" class=\"note-form-label\">' + opt.lang.image.url + '</label>' +\n '<input id=\"note-dialog-image-url-' + opt.id + '\" class=\"note-image-url note-input\" type=\"text\"/>' +\n '</div>';\n const footer = [\n '<button href=\"#\" type=\"button\" class=\"note-btn note-btn-primary note-btn-large note-image-btn disabled\" disabled>',\n opt.lang.image.insert,\n '</button>',\n ].join('');\n\n return dialog({\n title: opt.lang.image.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst linkDialog = function(opt) {\n const body = '<div class=\"note-form-group\">' +\n '<label for=\"note-dialog-link-txt-' + opt.id + '\" class=\"note-form-label\">' + opt.lang.link.textToDisplay + '</label>' +\n '<input id=\"note-dialog-link-txt-' + opt.id + '\" class=\"note-link-text note-input\" type=\"text\"/>' +\n '</div>' +\n '<div class=\"note-form-group\">' +\n '<label for=\"note-dialog-link-url-' + opt.id + '\" class=\"note-form-label\">' + opt.lang.link.url + '</label>' +\n '<input id=\"note-dialog-link-url-' + opt.id + '\" class=\"note-link-url note-input\" type=\"text\" value=\"http://\"/>' +\n '</div>' +\n (!opt.disableLinkTarget ? '<div class=\"checkbox\"><label for=\"note-dialog-link-nw-' + opt.id + '\"><input id=\"note-dialog-link-nw-' + opt.id + '\" type=\"checkbox\" checked> ' + opt.lang.link.openInNewWindow + '</label></div>' : '') +\n '<div class=\"checkbox\"><label for=\"note-dialog-link-up-' + opt.id + '\"><input id=\"note-dialog-link-up-' + opt.id + '\" type=\"checkbox\" checked> ' + opt.lang.link.useProtocol + '</label></div>';\n const footer = [\n '<button href=\"#\" type=\"button\" class=\"note-btn note-btn-primary note-link-btn disabled\" disabled>',\n opt.lang.link.insert,\n '</button>',\n ].join('');\n\n return dialog({\n className: 'link-dialog',\n title: opt.lang.link.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst popover = renderer.create([\n '<div class=\"note-popover bottom\">',\n '<div class=\"note-popover-arrow\"/>',\n '<div class=\"popover-content note-children-container\"/>',\n '</div>',\n].join(''), function($node, options) {\n const direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom';\n\n $node.addClass(direction).hide();\n\n if (options.hideArrow) {\n $node.find('.note-popover-arrow').hide();\n }\n});\n\nconst checkbox = renderer.create('<div class=\"checkbox\"></div>', function($node, options) {\n $node.html([\n '<label' + (options.id ? ' for=\"note-' + options.id + '\"' : '') + '>',\n '<input role=\"checkbox\" type=\"checkbox\"' + (options.id ? ' id=\"note-' + options.id + '\"' : ''),\n (options.checked ? ' checked' : ''),\n ' aria-checked=\"' + (options.checked ? 'true' : 'false') + '\"/>',\n (options.text ? options.text : ''),\n '</label>',\n ].join(''));\n});\n\nconst icon = function(iconClassName, tagName) {\n tagName = tagName || 'i';\n return '<' + tagName + ' class=\"' + iconClassName + '\"/>';\n};\n\nconst ui = function(editorOptions) {\n return {\n editor: editor,\n toolbar: toolbar,\n editingArea: editingArea,\n codable: codable,\n editable: editable,\n statusbar: statusbar,\n airEditor: airEditor,\n airEditable: airEditable,\n buttonGroup: buttonGroup,\n button: button,\n dropdown: dropdown,\n dropdownCheck: dropdownCheck,\n dropdownButton: dropdownButton,\n dropdownButtonContents: dropdownButtonContents,\n dropdownCheckButton: dropdownCheckButton,\n paragraphDropdownButton: paragraphDropdownButton,\n tableDropdownButton: tableDropdownButton,\n colorDropdownButton: colorDropdownButton,\n palette: palette,\n dialog: dialog,\n videoDialog: videoDialog,\n imageDialog: imageDialog,\n linkDialog: linkDialog,\n popover: popover,\n checkbox: checkbox,\n icon: icon,\n options: editorOptions,\n\n toggleBtn: function($btn, isEnable) {\n $btn.toggleClass('disabled', !isEnable);\n $btn.attr('disabled', !isEnable);\n },\n\n toggleBtnActive: function($btn, isActive) {\n $btn.toggleClass('active', isActive);\n },\n\n check: function($dom, value) {\n $dom.find('.checked').removeClass('checked');\n $dom.find('[data-value=\"' + value + '\"]').addClass('checked');\n },\n\n onDialogShown: function($dialog, handler) {\n $dialog.one('note.modal.show', handler);\n },\n\n onDialogHidden: function($dialog, handler) {\n $dialog.one('note.modal.hide', handler);\n },\n\n showDialog: function($dialog) {\n $dialog.data('modal').show();\n },\n\n hideDialog: function($dialog) {\n $dialog.data('modal').hide();\n },\n\n /**\n * get popover content area\n *\n * @param $popover\n * @returns {*}\n */\n getPopoverContent: function($popover) {\n return $popover.find('.note-popover-content');\n },\n\n /**\n * get dialog's body area\n *\n * @param $dialog\n * @returns {*}\n */\n getDialogBody: function($dialog) {\n return $dialog.find('.note-modal-body');\n },\n\n createLayout: function($note) {\n const $editor = (editorOptions.airMode ? airEditor([\n editingArea([\n codable(),\n airEditable(),\n ]),\n ]) : (editorOptions.toolbarPosition === 'bottom'\n ? editor([\n editingArea([\n codable(),\n editable(),\n ]),\n toolbar(),\n statusbar(),\n ])\n : editor([\n toolbar(),\n editingArea([\n codable(),\n editable(),\n ]),\n statusbar(),\n ])\n )).render();\n\n $editor.insertAfter($note);\n\n return {\n note: $note,\n editor: $editor,\n toolbar: $editor.find('.note-toolbar'),\n editingArea: $editor.find('.note-editing-area'),\n editable: $editor.find('.note-editable'),\n codable: $editor.find('.note-codable'),\n statusbar: $editor.find('.note-statusbar'),\n };\n },\n\n removeLayout: function($note, layoutInfo) {\n $note.html(layoutInfo.editable.html());\n layoutInfo.editor.remove();\n $note.off('summernote'); // remove summernote custom event\n $note.show();\n },\n };\n};\n\nexport default ui;\n","import $ from 'jquery';\nimport ui from './ui';\nimport '../base/settings.js';\n\nimport '../../styles/summernote-lite.scss';\n\n$.summernote = $.extend($.summernote, {\n ui_template: ui,\n interface: 'lite',\n});\n"],"sourceRoot":""}